Skip to content
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

Open
3 of 5 tasks
jamiebuilds-signal opened this issue Jan 20, 2023 · 5 comments
Open
3 of 5 tasks

Get preferred system locales #14

jamiebuilds-signal opened this issue Jan 20, 2023 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jamiebuilds-signal
Copy link

jamiebuilds-signal commented Jan 20, 2023

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.

User speaks Farsi and French. They prefer Farsi, but many apps don't support it, so they would like to fallback to French in those cases. However, many apps do not respect this preference and will instead fallback to the language they were written in, in many cases a language they do not speak, such as English.

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:

  • iOS and macOS
  • Linux with a desktop environment (such as KDE)
  • Android
  • Windows
  • WASM
@complexspaces
Copy link
Collaborator

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 preferredLanguages just take the first item currently.

@complexspaces
Copy link
Collaborator

complexspaces commented Jun 16, 2023

#22 implemented the API for this feature, and the full implementations for WASM and Windows. There are still platforms that need flushed out.

@complexspaces
Copy link
Collaborator

#24 implemented this for our currently-supported Apple targets.

@complexspaces
Copy link
Collaborator

@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.

@jamiebuilds-signal
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants