warn that RTL support is currently not planned

the current approach to html generation is
probably too jank to handle RTL correctly
This commit is contained in:
ed 2025-02-03 18:41:02 +00:00
parent 46e59529a4
commit 632f52af22
3 changed files with 83 additions and 0 deletions

View file

@ -28,6 +28,8 @@ aside from documentation and ideas, some other things that would be cool to have
* **translations** -- the copyparty web-UI has translations for english and norwegian at the top of [browser.js](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/web/browser.js); if you'd like to add a translation for another language then that'd be welcome! and if that language has a grammar that doesn't fit into the way the strings are assembled, then we'll fix that as we go :> * **translations** -- the copyparty web-UI has translations for english and norwegian at the top of [browser.js](https://github.com/9001/copyparty/blob/hovudstraum/copyparty/web/browser.js); if you'd like to add a translation for another language then that'd be welcome! and if that language has a grammar that doesn't fit into the way the strings are assembled, then we'll fix that as we go :>
* but please note that support for [RTL (Right-to-Left) languages](https://en.wikipedia.org/wiki/Right-to-left_script) is currently not planned, since the javascript is a bit too jank for that
* **UI ideas** -- at some point I was thinking of rewriting the UI in react/preact/something-not-vanilla-javascript, but I'll admit the comfiness of not having any build stage combined with raw performance has kinda convinced me otherwise :p but I'd be very open to ideas on how the UI could be improved, or be more intuitive. * **UI ideas** -- at some point I was thinking of rewriting the UI in react/preact/something-not-vanilla-javascript, but I'll admit the comfiness of not having any build stage combined with raw performance has kinda convinced me otherwise :p but I'd be very open to ideas on how the UI could be improved, or be more intuitive.
* **docker improvements** -- I don't really know what I'm doing when it comes to containers, so I'm sure there's a *huge* room for improvement here, mainly regarding how you're supposed to use the container with kubernetes / docker-compose / any of the other popular ways to do things. At some point I swear I'll start learning about docker so I can pick up clach04's [docker-compose draft](https://github.com/9001/copyparty/issues/38) and learn how that stuff ticks, unless someone beats me to it! * **docker improvements** -- I don't really know what I'm doing when it comes to containers, so I'm sure there's a *huge* room for improvement here, mainly regarding how you're supposed to use the container with kubernetes / docker-compose / any of the other popular ways to do things. At some point I swear I'll start learning about docker so I can pick up clach04's [docker-compose draft](https://github.com/9001/copyparty/issues/38) and learn how that stuff ticks, unless someone beats me to it!

View file

@ -61,6 +61,8 @@ if the value starts with `%` it will assume a jinja2 template and expand it; the
add your own translations by using the english or norwegian one from `browser.js` as a template add your own translations by using the english or norwegian one from `browser.js` as a template
> ⚠ Please do not contribute translations to [RTL (Right-to-Left) languages](https://en.wikipedia.org/wiki/Right-to-left_script) for now; the javascript is [not ready](https://github.com/9001/copyparty/blob/hovudstraum/docs/rice/rtl.patch) to deal with it
the easy way is to open up and modify `browser.js` in your own installation; depending on how you installed copyparty it might be named `browser.js.gz` instead, in which case just decompress it, restart copyparty, and start editing it anyways the easy way is to open up and modify `browser.js` in your own installation; depending on how you installed copyparty it might be named `browser.js.gz` instead, in which case just decompress it, restart copyparty, and start editing it anyways
you will be delighted to see inline html in the translation strings; to help prevent syntax errors, there is [a very jank linux script](https://github.com/9001/copyparty/blob/hovudstraum/scripts/tlcheck.sh) which is slightly better than nothing -- just beware the false-positives, so even if it complains it's not necessarily wrong/bad you will be delighted to see inline html in the translation strings; to help prevent syntax errors, there is [a very jank linux script](https://github.com/9001/copyparty/blob/hovudstraum/scripts/tlcheck.sh) which is slightly better than nothing -- just beware the false-positives, so even if it complains it's not necessarily wrong/bad

79
docs/rice/rtl.patch Normal file
View file

@ -0,0 +1,79 @@
RTL support is not planned, but it would be
something like this (just a whole lot more)
diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css
index e66279d4..2888be56 100644
--- a/copyparty/web/browser.css
+++ b/copyparty/web/browser.css
@@ -653,12 +653,10 @@ a:hover {
.s0:after,
.s1:after {
content: '⌄';
- margin-left: -.15em;
}
.s0r:after,
.s1r:after {
content: '⌃';
- margin-left: -.15em;
}
.s0:after,
.s0r:after {
@@ -668,6 +666,19 @@ a:hover {
.s1r:after {
color: var(--sort-2);
}
+.ltr .s0:after,
+.ltr .s1:after,
+.ltr .s0r:after,
+.ltr .s1r:after {
+ margin-left: -.15em;
+}
+.rtl .s0:after,
+.rtl .s1:after,
+.rtl .s0r:after,
+.rtl .s1r:after {
+ margin-left: -.5em;
+ padding: 0 .25em 0 0;
+}
#files thead th:after {
margin-right: -.5em;
}
diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js
index 33965a70..bf425cc7 100644
--- a/copyparty/web/browser.js
+++ b/copyparty/web/browser.js
@@ -1797,9 +1797,13 @@ var Ls = {
"lang_set": "刷新以使更改生效?",
},
+ "foo": {
+ "tt": "Foobar",
+ "rtl": "rtl",
+ },
};
-var LANGS = ["eng", "nor", "chi"];
+var LANGS = ["eng", "nor", "chi", "foo"];
if (window.langmod)
langmod();
@@ -1819,7 +1823,7 @@ for (var a = 0; a < LANGS.length; a++) {
t2 = Ls[LANGS[i2]];
for (var k in t1)
- if (!t2[k]) {
+ if (!t2[k] && k != 'rtl') {
console.log("E missing TL", LANGS[i2], k);
t2[k] = t1[k];
}
@@ -1829,6 +1833,10 @@ for (var a = 0; a < LANGS.length; a++) {
if (!has(LANGS, lang))
alert('unsupported --lang "' + lang + '" specified in server args;\nplease use one of these: ' + LANGS);
+if (L.rtl)
+ document.documentElement.setAttribute('dir', L.rtl);
+document.documentElement.className = L.rtl || 'ltr';
+
modal.load();