-
Notifications
You must be signed in to change notification settings - Fork 25
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
Localization (i18n): notes and planning #72
Comments
posixutils-rs Localization ProposalRequirements after offline discussion with @jgarzik :
BOTH of the following implementation strategies are valid: Considerations/Research2b) OS Error StringsAccording to https://stackoverflow.com/questions/43019882/does-libc-show-international-error-messages it seems like we should be able to use https://docs.rs/libc/latest/libc/fn.strerror.html to gain access to system provided localized messages for libc errno codes, but it sees like there might be some safety concerns related to using this function that will warrant more investigation if we use it https://users.rust-lang.org/t/unsafe-and-strerror-impossible-to-fix/90804 It seems like it should be possible https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=52ae229dd19b14298c25d488516d3750 . Here is the output using the french locale installed on my system: It seems like Interestingly the 2c) –help messagesWith the exception of Message FormatWhile an obvious choice for message format would be to use GNU gettext, some arguably better and more modern alternatives do exist. fluent puts forward some good arguments for the choices it makes that are different https://github.com/projectfluent/fluent/wiki/Fluent-vs-gettext In summary of this article:
Further comparisons between systems and crate implementations:
ProposalThis proposal is that we definitely use the The next decision is what to use for the scaffolding around |
Related recent unsolicited work: #254 |
@jgarzik raised some interesting points regarding this:
With this in mind, it seems like, despite it's shortcomings, it looks like gettext is fully endorsed by the POSIX.2024 spec, and therefore in the spirit of implementing it, it would be best to use For gettext library functions we have two pre-existing options:
There is no default message formatting function within these I'd propose that we start by creating our own implementation for |
Pretty interesting related reading in this answer (for setting locale): https://unix.stackexchange.com/a/149129 |
Yep; that is also a good checklist for posixutils. We need to be responsive to these LC_xxx, and are not yet there. |
Introduction
Soliciting discussion over the localization (i18n) strategy for this project.
Goals
Goal 1: Localize everything
The goal is complete localization of all messages visible to the user, within the bounds of POSIX compliance:
clap
crate)io::Result
)Goal 2: Encourage UTF-8
To be forward-looking, this project looks for opportunities to
This project should aggressively interpret the POSIX standards in terms of UTF-8 support, and look for opportunities to create default-UTF-8 operating modes, with a fallback mode that is "POSIX-ly correct."
Implementation strategies
Current strategy
The current strategies are,
gettext
crate, and mark strings withgettext()
. This provides a starting point for per-util coding, and at least gets us started on the road to i18n.Improvements to our i18n
At present, OS error messages and --help are not translated at all, and need a project-wide strategy.
Also, one idea that is aligned with the
gencat
util is to generate catgets message catalogs and abandon gettext. This works because catgets exists on all modern platforms.See issue #65 for util-related tasks.
Feedback and thoughts are requested. We want to give users the best i18n support possible.
The text was updated successfully, but these errors were encountered: