os-js / osjs-client

OS.js Client Module
https://manual.os-js.org/
Other
31 stars 31 forks source link

Right-to-left layout setting #90

Closed corwin-of-amber closed 4 years ago

corwin-of-amber commented 4 years ago

Since I live in Israel, OS.js correctly identifies that I am using one of those weird languages that are written from right to left. As such, it sets the layout direction to rtl.

Localization is generally a good idea, but since there are no Hebrew (he_IL) translations for any of the captions, this ends up looking pretty strange.

I don't know what a good solution might be, can OS.js somehow detects that it actually does not have the Hebrew locale "package" or whatever and go back to left-to-right?

Also, ALL my system settings and my browser settings have en_US as the default language. What setting is OS.js using to make it prefer the right-to-left layout?

If I set the locale to en_US using the Settings app, then obviously everything lines up again.

Screen Shot 2020-02-03 at 18 42 04
andersevenrud commented 4 years ago

There's actually a list that sets the rtl styles explicitly: https://github.com/os-js/osjs-client/blob/master/src/config.js#L190

But maybe the browser sets rtl on the body by default because of your system locale ? And this has to be added into the osjs-client styles:

https://github.com/os-js/osjs-client/blob/master/src/styles/_core.scss#L51

corwin-of-amber commented 4 years ago

It happens because of this line: https://github.com/os-js/osjs-client/blob/8e9a8d4d3a748e632f7c809ab32d37799eae9305/src/utils/locale.js#L181

Why is OS.js opting to choose the last language in the list of supported languages? Has previous experience gave the conclusion that the last one is usually the user's preferred language?

andersevenrud commented 4 years ago

Since I didn't comment that, I'm not 100% sure :joy:

It might have been because (as you say) I noticed that en_EN was always first on the localized systems I've tried.

I have to look into this again.

andersevenrud commented 4 years ago

In hindsight, that might have been pretty stupid, hehe.

andersevenrud commented 4 years ago

If you have the time, could you check out this patch ?

https://github.com/os-js/osjs-client/pull/91

I don't know what a good solution might be, can OS.js somehow detects that it actually does not have the Hebrew locale "package" or whatever and go back to left-to-right?

This patch makes sure that the detected default language is either a part of the configured language list or the hard-coded fallback one.

andersevenrud commented 4 years ago

Ehm. Hold on a bit on that. Apparently jest did not run in my git hook and there were some issues :blush: I'll let you know when it's ready.

andersevenrud commented 4 years ago

I believe this was solved in #91 which was released today. Let me know how it works out and re-open if it's still an issue :)