-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Multi-language/I18n support #22
Comments
Most Gateways go to German speaking countries so it makes perfect sense to provide the interface in their own language. I get some questions about it regularly. |
Yes, that would be nice. What about a changeable language-file in the spiffs? There is a lot of space left and you have only one software. |
That's a good idea. Store the localizations in SPIFFS and download to PROGMEM when EMS-ESP boots. |
In order of importance
For the web I had a look at react-intl, i18next-react, polyglot and this one called lingui-js but they'll all quite big libraries and there is just not enough progmem to store all the translations to have it real-time on the ESP8266. react-intl is the right one here (14k zipped). |
First localized version of the UI is looking promising. |
with the extra 160K on the ESP32 I can easily store the strings in SPIFFS and load them dynamically |
Going to look at this again. |
started working on this again. It's easier now since we moved React to use hooks. I have selectable languages for EN and DE and starting to translate the UI. I've been thinking how to store the translations and ideally, it would be great if this was in a custom JSON file the user can upload and replace, but for now I'm hardcoding it. @MichaelDvP one thing that struct me is the amount of memory we have left on the ESP32. I remember the countless long weeks I used to spend optimizing every heap byte on the ESP8266 with version 2 so it wouldn't run out of memory and crash. On the ESP32 we have still 250KB of RAM and Flash both available so I was wondering what difference it would make if we ran the web pages not in PROGMEM and also all the F_() text literals in normal Memory instead of Flash. It may be faster ! I'll run some tests and see..... |
The web code is 300KB so needs to stay in flash, but its cached by the browser anyway. |
I finished the coding on this. You can switch real-time between UK and DE and the Web UI and Device Entities change. Problem is I've run out of Flash memory so now need to go back to the drawing board to see how to squeeze this into the tiny 4MB Flash the E32 and S32 boards have. On BBQKees's latest prototype it works like a dream since it has an embedded ESP32 chip with 16MB flash! @MichaelDvP I might need your expertise here to hack the IDF partition tables. |
I managed to squeeze in the languages into the 4MB flash and make it dynamic. So you can adjust the language in the WebUI from the sign-on screen and also change the language of the device entity names from the Settings without re-starting the ESP32. A few notes
The code is at https://github.com/emsesp/EMS-ESP32/tree/v3.5.0 @bbqkees @MichaelDvP can you give it a whirl and see if it works? |
I can help with polish translation if you like. I didn't have time to go through the whole threat yet, but if you could send me some details of what is needed, i'll try |
@pierafal Great, there are two files to edit.
If you want to check the we translations you can use the mock-api, but for the entities you need to compile and flash to emsesp. |
@MichaelDvP let's create a section in the 'For Developers' section on the wiki stating the steps needed to add a new translation. |
I've made a PR to the doc with (hopefully) all steps to add a new language. Please check. |
Which languages do we want to implement in this first round? |
It wasn't Finnish (my mistake) but Norwegian! Viking_NO requested it on https://discord.com/channels/816637840644505620/816638754772353095/1004403792529346732 |
Polish (PL) translation is underway but it'll take a few weeks and will be incomplete. We may decide to comment that language out to avoid confusion when we push 3.5.0 to dev |
Ok, i think remove only the selections. (Edit: Sheet removed, please use newer sheet below) |
This is the web translations as table: |
that's great if you have a script that can quicky output the locale string data |
It's only export csv and three replace operations in editor, |
I've tested the way back, maybe it's easier if we leave line start/end as fields, and replace only multiple semicolon. BTW: in this spreadsheet missing translation could be seen much easier, @mvjt could you please check lines 353-356 and 407, 408. (Edit: sheet removed) |
Hi @MichaelDvP , the Swedish translations for 353-356 and 407,408 are there. You're missing the NL translations. So the Swedish ones are now in the NL column. |
Thanks for checking, @bbqkees could you please take a look. |
Kees is on holiday so I'll see if I can add the NL ones. |
I tried to do my best to adjust some German translations (marked in yellow). I have to admit that I do not understand all parameters and some descriptions are not unique ..... |
Thanks Thomas, |
hi, i've done pretty much of the web translations but i see some issues. Please see the web.xlsx, a color cells in column F requires some clarification to understand the context. Can someone please review that and comment?
What do you think of creating a screen shots of each WEB page in english to have a context of what we're translating. IMHO a list of words is not enough to create a good translation. We need to understand the context |
Yes it's not easy to understand the context. For web translations it is best to use the mock-api and check the webpage with your translations to see the context.
If you don't compile yourself, the v3.5 is now in dev, you can download the bin and test the EN page and check the context.
|
Tested the pluralisation, it has to be Updated list with web and entities: locale_translations.xlsx |
I've found that the EN-fallback in web only works only for a missing index-file, not for single word missing. So i set missing texts to english and marked them red in the xlsx. |
I've added the missing NL ones |
Guys, sorry but i'm not sure what should I do to use mock-api. I was expecting doing some tranlslation in a human readible form like xls. I'm still ready to work on that but I'd need more detailed instruction. |
did you edit the files in the repo or update the XLS? Sorry, can't remember... |
I edited the xls file |
ok, are you able to use check out the source file from the repo, make the edits and push back as a PR? If you've never worked in github before we can always do it manually from the XLS you created but it'll take some time https://emsesp.github.io/docs/#/Coding?id=adding-a-new-language |
@pierafal Your web translations from xls file are already implemented in the dev. Only a few words are missing, see here. You can flash the dev and check, no need for the mock-api. Next is to add translations of entities in locale_translations. You can use the xls or edit a local copy of locale_translations.h |
the last changes to support Polish were added. Closing this now. |
Support multi-locale for Telnet console commands, MQTT, SysLog messages and the Web. Since there is not enough memory to hold all the translations it will have to be different builds (DE, NL, UK). String literals will be stored in translation files and built at compile time.
@MichaelDvP @bbqkees what you vote for this feature?
The text was updated successfully, but these errors were encountered: