Open felixLam opened 7 years ago
@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
: