cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX - can't switch language.

HTD
Senior III

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.

4 REPLIES 4
HTD
Senior III

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.

Osman SOYKURT
ST Employee

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

Osman SOYKURT
ST Software Developer | TouchGFX

Yes, I'm just making multilingual UI and I'm amazed how quick and easy it is.

Awesome, great to hear that!

/Osman

Osman SOYKURT
ST Software Developer | TouchGFX