-
Notifications
You must be signed in to change notification settings - Fork 98
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
Confusion of using in a multi-locale environment #64
Comments
Great point! Sorry for the confusion. The reason we take a list of locales is to allow for Intl formatters that are (or, in case of Rust, will be) used by the context to fallback as well as possible between locales. But See, for example the In Rust, we will want to implement a similar logic using some cached-iterator strategy. What I'm currently waiting for with this is to stabilize fluent-rs a bit (which I hope to do quite soon around Fluent 0.7), and for async/await to land in Rust. Hope that helps! I'll keep the issue open to improve documentation around it. |
I'm starting to look into the learning curve of fluent-rs and this is my top priority. I'm considering introducing a simple resource manager (#88) which would give you an example of how you can bootstrap your project and use the locale fallbacking and locale changes. I'll ask for feedback once I have more concrete PR. |
See the work I've been doing in djc/askama #211 for one use case. There I'm taking the slightly-odd approach of baking localization files into the output executable, since it's a web framework designed to deploy to a static binary anyway. Having support for fallback chains for missing messages would be amazing. I was thinking about implementing it myself but if it's being worked on here than I can just wait for that. |
@renyuneyun, @kazimuth - can you both evaluate current examples in It's still super early (I'll release those higher level crates as 0.1), but should be good enough to start collecting feedback. |
I ended up rolling my own implementation of |
@zbraniecki Thanks a lot. It seems the crate is missing from crate.io , at least for fluent-resmgr. Anyway I copied the source code to test. For fluent-fallback, the document is not clear how to use it. Briefly looking at the code makes me more confused. Isn't it meant to be used in conjunction with fluent-resmgr? |
@renyuneyun @kazimuth - I just merged a change #114 which hopefully will make it much easier to work with FluentBundle. You can now just push the I'll release |
I just released 0.7. It can handle any I also released On top of that, I released initial version of This should fix this bug! Reopen if needed! |
I guess the goal of fluent-rs is to provide a full functioning i18n system with fluent syntax, so the environment of multi-locale will be encountered.
The signature of
MessageContext::new()
takes a slice of strings as the parameter, which is said toHowever, in the next section:
The design seems to be conflicting with itself - if
MessageContext
only stores value of one locale, how does it do locale fallback?This leads to quite a confusion for me, and I don't really know how to use fluent-rs in a multi-locale environment where fallback is really needed.
The text was updated successfully, but these errors were encountered: