-
Notifications
You must be signed in to change notification settings - Fork 29
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
Implement FluentLanguageLoader::get_lang(...) methods #84
Conversation
This adds the following methods: - get_lang - get_lang_args - get_lang_args_concrete - get_lang_args_fluent Those methods work exactly like their non-lang counterparts but add a lang argument that can be used to specify a list of language codes without needing to change the global current language setting. This closes kellpossible#59.
78e21c6
to
3f35f04
Compare
While at it I also refactored all the other I was wondering about the original implementation of |
@kellpossible I don't really like the interface of this. What do you think about adding a If you agree with that change I'd change that PR so it doesn't add the |
@saskenuba Could you please review this PR? I ended up going a different route and implementing |
The CI failures have nothing to do with the actual code changes. 🤔 |
@bikeshedder would you still like me to review this? |
Having that merged doesn't hurt as it adds a important feature without breaking any existing code. I'm still looking into implementing #82, but tbh. that's an entirely different beast as it requires some major refactoring. |
looks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just the code format and question about itertools
i18n-embed/Cargo.toml
Outdated
@@ -24,6 +24,7 @@ fluent-syntax = { version = "0.11", optional = true } | |||
gettext_system = { package = "gettext", version = "0.4", optional = true } | |||
i18n-embed-impl = { version = "0.8", path = "./i18n-embed-impl", optional = true } | |||
intl-memoizer = "0.5" | |||
itertools = "0.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still being used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used that in an earlier version but could then use the builtin .chain()
method. It's not being used.
I removed the unused dependency |
Released in |
Adds a single new method lang. This methods allows creating a shallow copy of the FluentLanguageLoader which can than be used just like the original loader but with a different current language setting. That makes it possible to use the fl! macro without any changes and is a far more elegant implementation than adding multiple get_lang* methods as done in #84. Co-authored-by: Michael P. Jung <[email protected]>
Re-implementation of #59 (a rebase and cleanup of #88) Adds a single new method lang. This methods allows creating a shallow copy of the FluentLanguageLoader which can than be used just like the original loader but with a different current language setting. That makes it possible to use the fl! macro without any changes and is a far more elegant implementation than adding multiple get_lang* methods as done in #84. Co-authored-by: Michael P. Jung <[email protected]>
This PR adds the following methods:
Those methods work exactly like their non-lang counterparts
but add a lang argument that can be used to specify a list of
language codes without needing to change the global current
language setting.
This closes #59.