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

Is there a way to pick up the current locale from the OS? #12

Open
hjmallon opened this issue Aug 28, 2019 · 6 comments
Open

Is there a way to pick up the current locale from the OS? #12

hjmallon opened this issue Aug 28, 2019 · 6 comments

Comments

@hjmallon
Copy link
Contributor

hjmallon commented Aug 28, 2019

Is there a way to use this (or an adjacent crate) to grab a locale representing the current OS context? I assume this would require different OS backends (at least POSIX and Windows probably).

Edit: Having had a look around it seems a few crates are implementing the functionality, often only on certain platforms.

@zbraniecki
Copy link
Owner

This crate is currently aiming to handle language negotiation operations. Pulling various locale fallback lists from the OS is not in scope. (I believe such a crate would be useful tho!)

@bbqsrc
Copy link
Contributor

bbqsrc commented Dec 15, 2019

Is it not in scope as you personally do not wish to maintain it, or see it as antithetical to the purposes of this crate? I ask because I have implemented this for macOS and Windows, and would be happy to take up the work necessary to keep it maintained. 😄

@zbraniecki
Copy link
Owner

Is it not in scope as you personally do not wish to maintain it, or see it as antithetical to the purposes of this crate?

The latter. Crate that will interact with the underlying OS will require dependencies and specific kind of testing and maintenance to handle, likely growing, number of OSes to support.
I'm ok adding such crate to the unic-locale metacrate, but would not want to keep it as part of any of the foundational crates.

@zbraniecki
Copy link
Owner

I'd like to point out that there's an effort now to develop a set of components similar to ICU4C using Rust, and the crates we have here would likely be part of that - https://github.com/i18n-concept/rust-discuss/issues

In such a case, any OS operations would be managed by a component like unic-environment or sth like that.

@bbqsrc
Copy link
Contributor

bbqsrc commented Dec 16, 2019

A unic-env crate would be cool. I've already done some work on wrapping FFI functions on Windows and macOS for getting the preferred languages, and also using the POSIX LANG environment variable, but haven't published it anywhere yet.

I'd like to contribute to this sooner than later, so what do you propose that I do? 😄

@zbraniecki
Copy link
Owner

I'd like to contribute to this sooner than later, so what do you propose that I do? smile

File an issue in https://github.com/i18n-concept/rust-discuss/issues and start a conversation about the scope of such crate.

The retrieve various types of locale lists from OS is one, but likely other os-specific hooks would be useful like retrieve the date/time style customizations, retrieve hourCycle h12/h24 overrides, retrieve first day of the week override and so on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants