Skip to content

Conversation

@NoahTheDuke
Copy link
Collaborator

@NoahTheDuke NoahTheDuke commented Mar 8, 2025

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 to tr: :stats.win-rate is {: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-rate became stats_win-rate.

because of that, every call to tr has 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 tr call 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.

@NoahTheDuke NoahTheDuke merged commit 7037424 into mtgred:master Mar 22, 2025
3 checks passed
@NoahTheDuke NoahTheDuke deleted the nb/fluent branch March 22, 2025 11:47
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

Successfully merging this pull request may close these issues.

1 participant