balena-os / wifi-connect

Easy WiFi setup for Linux devices from your mobile phone or laptop
Apache License 2.0
1.28k stars 360 forks source link

Multi language support (i18n) #358

Open maggie44 opened 4 years ago

maggie44 commented 4 years ago

With the new react-rendition UI from @sradevski, is it possible to integrate support for adding our own language files? Presumably I am not the only one using Balena in English and non-English speaking contexts.

Would inevitably create some challenges. A drop down menu would be required on the UI, perhaps populated by the contents of a languages folder would probably be more viable than at build time of the UI due to the way we create the container right now. It could draw on the same method as the --custom-ui feature. Probably a new string to launch wifi connect with too, that allows changing the default languages from English (--default-language=fr). Alternatively or additionally, pass a string in a url on accessing the interface (?link=fr) which would provide the added benefit of being able to better integrate in to apps that have already had a user set a language.

I'm sure many other challenges too, but wanted to float the idea.

maggie44 commented 3 years ago

A little rudimentary to be sure, but here is my current approach taken to allow custom messages and to allow multiple languages. Shared here for others to use as a interim measure:

https://github.com/LearnersBlock/learners-block/tree/master/controller/wifi-connect-ui/ui

Passing /?language=xx on the end of the URL, where xx is a two digit language code (en, fr, de, ar) will change the main message languages to those set in the JSON files stored in ./ui/src/components/i18n/