2022-09-04 11:01 AM
I defined a text in 3 languages in Texts in Designer.
When I set the language in the designer, my label is translated correctly.
Then I made 3 buttons and assigned "ChangeLanguage" action to each.
When I run the application and click the buttons - nothing happens.
Here's the function the TouchGFX generated:
void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src == &langGB)
{
//Interaction1
//When langGB clicked set language GB
//Change language to GB
Texts::setLanguage(GB);
invalidate();
//Interaction4
//When Interaction1 completed call virtual function
//Call redraw
redraw();
}
else if (&src == &langPL)
{
//Interaction2
//When langPL clicked set language PL
//Change language to PL
Texts::setLanguage(PL);
invalidate();
//Interaction5
//When Interaction2 completed call virtual function
//Call redraw
redraw();
}
else if (&src == &langZA)
{
//Interaction3
//When langZA clicked set language ZA
//Change language to ZA
Texts::setLanguage(ZA);
invalidate();
//Interaction6
//When Interaction3 completed call virtual function
//Call redraw
redraw();
}
}
The functions are called, but well, nothing happens. The label is not translated.
2022-09-04 11:10 AM
Ooopsie! Why is this always happening when I ask the question? Somehow my texts changed to the same text in all languages. So it worked, but all translations were the same. I changed the translations again and now it works.
2022-09-05 12:37 AM
Hello HTD,
So everything is working fine?
We're doing a new tutorial about how to use texts and add new languages. We'll make it available on our support website soon :)
/Osman
2022-09-06 05:46 AM
Yes, I'm just making multilingual UI and I'm amazed how quick and easy it is.
2022-09-06 06:19 AM
Awesome, great to hear that!
/Osman