-
Notifications
You must be signed in to change notification settings - Fork 404
Use Fluent instead of tempura #7997
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
as a broader move to support work like #7971, i've done some research and decided we should switch from tempura to Fluent.
Notes
id separator
tempura separated nested maps with dots (
.) in the ids given totr::stats.win-rateis{:stats {:win-rate "..."}}. fluent only allows dash and underscore as special characters in identifiers, so when converting the nested maps of tempura to fluent, each level of nesting was changed to an underscore:stats.win-ratebecamestats_win-rate.because of that, every call to
trhas been changed to use the new ids.variables in tr calls
tempura allowed for arbitrary clojure code as the translation value and passed any arguments in positionally in a vector. fluent variables are named and passed in a map. keeping with clojure conventions, the keys can be keywords (and are updated to strings before formatting).
because of that, every instance of arguments sent in a
trcall have been changed to a map, and then corresponding translation messages have been changed to fluent selectors.lazy loading
instead of sending all translations in one clojurescript blob on load, each translation bundle is sent as requested by the client, defaulting to the user's
navigator.language. when a user changes the language in the settings, the new translation bundle is sent and the ui changes reactively.fluent file formatting
i wrote a formatter for fluent files in
tasks.translations. should help us keep things neat. i didn't expose it as a leiningen alias but maybe i should?translation message comparisons
i ended up not writing an editor for fluent file comparisons because that's a ton of work and i don't wanna force translators to set up and run local instances of jnet. however, i think it's worthwhile and hope to do it at some point in the future.
maybe i'll do it separately and host it in heroku or something.