-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get preferred system locales #14
Comments
Thanks for filing this, I agree it'd be nice to expose a preference list instead of "this locale or nothing." This isn't a high priority item for me at the moment but I'd happily accept a PR if someone gets there before me. Regarding the implementation, WASM and iOS/macOS are already pretty close to this underneath. Notably, the Apple platforms already use |
#22 implemented the API for this feature, and the full implementations for WASM and Windows. There are still platforms that need flushed out. |
#24 implemented this for our currently-supported Apple targets. |
@Dinnerbone @jamiebuilds-signal I've published 0.3.1 a few minutes ago, so this new functionality should be available now for the currently supported platforms. |
Looking at the docs, I would caution about describing the order as the users order of preference. As I understand it, generally you don't have to use the earliest listed language that you support. Often apps will have better and worse quality translations and can serve the better quality translation if its still a match |
Since there haven't been any updates in #28, I've decided to rewrite my thoughts here. Based on the mentioned earlier link https://github.com/electron/electron/blob/main/shell/common/language_util_linux.cc and the link referenced there chromium/src/l10n/l10n_util.cc, I think we should use following variable order in locale evaluation: Here are some relevant sources that might help clarify the role of the
Ideally, it would be useful to implement separate functions for determining the general locale and the message locale (and, ideally, for each specific Additionally, if we aim to provide the user with a list of locales in descending order of preference (with the |
Yes, I think this makes sense to me and I don't have any historical reason this crate didn't use
While I agree in theory, I'm not sure if every platform this crate needs to support has the equivalent of per-category languages and my preference would be to keep
The purpose and intent of |
Can you clarify the compatibility reasons for keeping
That's my suggestion! We can first check the |
Its really because I don't know if anyone has been relying on this less-then-perfect logic in the "wild", so starting to ignore it in a patch release might be offputting. I don't mind giving it a try, I'm just cautious 😅.
Got it, I just wanted to make sure we were on the same page. I was playing around with this a bit more while writing this comment and found that KDE seems to set the Its quite strange that its just set to a empty string when only one language is configured, but maybe that was improved in more recent releases (my VM is pretty old): |
I think we can assume that in an overwhelming number of cases,
KDE sets the
This is true for my version of Plasma 5.24.7. |
Fair enough, we can go ahead and plan to do that then.
I knew it stored this in a
Odd, but at the end of the day not an actual problem since we will still be looking at |
Obtaining a list of preferred locales is now implemented for Linux. |
Linux support for preferred locale listing has been released in 0.3.2. |
@complexspaces, should the |
I thought I did that when making the release, my bad. Its checked now. |
It is relatively common that a multi-lingual speaker would specify fallback languages on their system in case a program does not have strings for their most preferred language.
This is unfortunate, and it would be nice if the Rust ecosystem had a cross platform library for retrieving all the users preferred languages.
Links for platform APIs and other code examples:
Platform support currently contains:
The text was updated successfully, but these errors were encountered: