Parsing system locales #6028
Replies: 4 comments 7 replies
-
Yes, we'd welcome contributions! I think the legacy variant section is correct, though note that ICU4X doesn't ship any data around these by default. @sffc to confirm that this is the route we should take. |
Beta Was this translation helpful? Give feedback.
-
You are correct, the student that started this crate did not get to this phase, but the intention is to normalize API between env_preferences and anything else use Locales everywhere. IIRC the original idea is that there should be that you can use per-OS specialization to get an unprocessed response from the OS (so, for example I'd be happy to brainstorm that with you and review your design. |
Beta Was this translation helpful? Give feedback.
-
I've almost finished my draft POSIX implementation, and the only edge case in my dataset that isn't handled is full locale names, for example "french", "deutsch", "eesti". I'd like to use CLDR if possible to match each full name to the language ID, for example "french"->"fr". Most of the locale names (29/35) have a matching <language type="fr">French</language> I'd like to use this CLDR data if possible, and potentially handle the remaining 6/35 edge cases manually. If anyone is able to let me know how I can integrate the relevant data into my Rust code, that would be very much appreciated! The Thought it might be worth mentioning that the CLDR file List of full locale names in
|
Beta Was this translation helpful? Give feedback.
-
I've found 2 valid Windows locales that
|
Beta Was this translation helpful? Give feedback.
-
Hello all!
I've been experimenting with integrating icu4x into user-facing applications for a while now, and was very excited to see the progress made by GSoC student @ashu26jha in #5081 and #5358 on retrieving the system locale. If there is interest in doing so, I would be very interested in contributing to the
env_preferences
crate that came out of this work to make it easier to use out-of-the-box.This is motivated by my computer (
x86_64-unknown-linux-gnu
) returningOk({All: "C"})
from the linux implementation ofenv_preferences::get_locales
. Ideally,env_preferences::get_locales
would returnLocale
instead ofString
, so I can immediately use the unwrapped result withicu_datetime
,icu_plurals
etc. I assume parsing these strings into locales is the kind of logic that should be handled by icu4x rather than duplicated across downstream users - but please correct me if I'm wrong!At least on Linux, I would expect to solve this according to TR35's section on legacy variants. If possible, I'd love feedback on this solution, and if there's interest in such a contribution at all. I am very happy to do the work but don't want to interfere with anyone's existing progress or create an unwanted PR :)
Beta Was this translation helpful? Give feedback.
All reactions