nrenner / brouter-web

Web client for BRouter, a routing engine based on OpenStreetMap
https://brouter.de/brouter-web/
MIT License
360 stars 68 forks source link

i18n: add a language picker #229

Open Phyks opened 5 years ago

Phyks commented 5 years ago

Hi,

What about letting users overload the default i18n value (based on browser locale I think)? I have two typical examples in mind:

  1. When developping BRouter, it would be an easy way to ensure having an English locale easily (and then using the "default" translations).
  2. A user reported to me that he was thinking brouter.de/brouter-web was only available in German as he was seeing the German version and no way to change the language. Therefore, he was reluctant to passing the link to some French friends, thinking they would not understand the interface.

Best,

bagage commented 5 years ago

You can use ?lng=en in the URL like https://brouter.damsy.net/latest/?lng=de#map=12/45.0574/5.1955/standard to force the langage. In this case it is persisted in local storage. But we could add a language picker indeed,sounds easy to implement

Phyks commented 5 years ago

Oh, I did not know about the lng GET parameter, thanks for the tip!

:+1: for having a language selector.

nrenner commented 5 years ago

We were undecided about the language selector, but as your example shows, I guess it would at least make it clear that the app is translatable and what languages are available.

Looks like switching can be done with i18next.changeLanguage.

Would be nice to have a way to get the list of available languages without requiring a release, e.g. from config.js or a separate file generated by the build or transifex-pull script.

tvaknin commented 2 months ago

Hi, Isn't this a fundamental requirement? It would help a lot.
BTW, I saw the Hebrew translation is still pending, can someone enable it in Transifex?