Start a new topic

Best practise for table of static texts

 Hello everybody,


we are still working on a multi-language application. The language can be changed during runtime. The language depended texts are assigned each time a new screen is loaded. Our current implementation is working but very simple and stupid.


We have some kind of menu that contains a language setting.

A simple variable 'languageSet' storing a number.

(german = 0, english = 1,...)


Everytime a new screen is displayed we assign the text according to languageSet in the Preinitialize Event:


if(Splash.languageSet.val==0) //DE
{
  Settings.t0.txt="EINSTELLUNGEN"
  Settings.t1.txt="SPRACHE"
}
if(Splash.languageSet.val==1) //GB
{
  Settings.t0.txt="SETTINGS"
  Settings.t1.txt="LANGUAGE"

}


We would like to improve this handling. For every language a new if-case is needed. Lots of screens are hard to maintain with different language updates.

If two screens use the same text, it is added twice.


In c-code I would create a global structure like this.

char* settingsText[] = { "Einstellungen", "Settings"};


Then access it like:

Settings.t0.txt = settingsText[languageSet];


My questions is:

Has anybody already created such a structure? Or has somebody a better idea? Currently I dont know how to implement something like this with NextionEditor.

If it is possible at all.


Help is really appreciated.

Thanks.


BR Marcel



1 Comment

Many things possible

 - depends heavily on amount of static text.