-
Notifications
You must be signed in to change notification settings - Fork 14
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
Regional and scripts specific locals #202
Comments
Technically, there should be no problem for
as stated by the
|
We could instead of having a constant, use a lazy initialized static and parse the locale on first access, if you want to make that change I'm open for a PR |
The real question would probably be about translations duplication, if for example |
Wait I missread the docs, |
The |
Amazing! Thanks for your prompt attention. So we may want to wait for niche use cases of locale to change the behavior of the initialization? |
yep we can wait, until someone with "sl-IT-rozaj-biske-1994" or other obscure locales open an issue, I consider it working |
But I'll look into extending / overriding / de-duplicate other locales translations |
The logic is feasible, the question is how complicated it gets, technically it was done for defaulted values before the rewrite for the dynamic loading, but now that static strings are regrouped it gets more complicated so I skipped it, might want to re-introduced it |
Most of the work has been done in #206 , now it's just a matter of how to define defaults, something like [package.metadata.leptos-i18n]
default = "en"
locales = ["en", "fr", "en-GB", "fr-CA"]
extends = { fr-CA = "fr" } Not sure about the name tho |
@Baptistemontan Shouldn't that be done automatically? We can detect the language with - en-GB, en-US will be defaulted to en if exists, or the global default locale, and the en will be defaulted to the global locale.
- fr-CA will be defaulted to fr if exists, or the global default locale, and the fr will be defaulted to the global locale. This logic is clear and will not also introduce circular dependencies. IMHO, with the logic introduced in #206 it makes it much harder to maintain the translations and the default logic behind it... |
#206 did not introduce any new logic for the user, nothing changed other than how default values are handled and their observable behavior is exactly the same as before |
my comment above is just a proposition, and yes your comment make sense, but I prefer to minimize implicit behavior and allow customization when it's really easy to introduce. If the user wants extends = { fr-CA = "fr", fr = "fr-CA" } if a key is missing in both, default to Can you elaborate on how this would make translations harder to maintain ? |
Sorry for my bad understanding of your PR comments. I'm not against having a feature to control the inheritance of locales. I've proposed a global common-sense logic on the inheritance which it doesn't require configuring it by hand. In other cases that a user needs to change the order of inheritance, they can do it by your proposed About naming your feature, I think
|
Tbh both can be implemented, and both make sense, but introducing your proposition will need a major version bump as it will implicitly change some behavior. I'm not against it, but for now I'll go with the inheritance, and adding an implicit default to the base locale will be almost trivial in the future |
Is there any way to define and use regional and script specific locals?
For example:
Comprehensive langid/locale handling: https://unicode-org.github.io/icu4x/rustdoc/icu/locale/struct.LanguageIdentifier.html / https://docs.rs/icu/latest/icu/locid/struct.Locale.html
The text was updated successfully, but these errors were encountered: