-
Notifications
You must be signed in to change notification settings - Fork 6
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
Support run-time language switching #2
Comments
@felixLam So in general this sounds a reasonable approach. Just some of my thoughts:
|
Please look into using translation tables. I have dropped the idea of putting an Elm front end to a Rails site, because I will have to code, test and maintain four different sets of front end code: English, Bosnian, Croatian, and Serbian. Please look at the simple and effective approach that Rails uses for internationalization. see: http://guides.rubyonrails.org/i18n.html |
@tayloredwebsites have you seen https://github.com/michaeljones/elm-message-format-experiment, which uses ICU syntax? |
We might consider providing an additional elm writer that creates multilingual modules. This would allow elm-apps to switch at runtime.
Assuming that the following current "modules" exist per language containing one string constant each:
Translation.Main
helloWorld : String
Translation.ErrorMessages
notFound : String
The multilingual mode would create a language definition, e.g.:
It would then generate the following modules:
Translation.Main
helloWorld : Language -> String
Translation.ErrorMessages
notFound : Language -> String
Translation.Main.De
helloWorld : String
Translation.Main.En
helloWorld : String
Translation.ErrorMessages.De
notFound : String
Translation.ErrorMessages.En
notFound : String
The elm app would then use
Translation.Main
orTranslation.ErrorMessages
.Example implementation of
helloWorld : Language -> String
:The text was updated successfully, but these errors were encountered: