75 views
in GUI Development by

Hi community,

I am very new to Embedded Wizard, and even so I have been able to implement a simple menu to change some parameters units (temperature, distance, etc.), language and time & date. In this case, I have two project members of type "Language" (Spanish and English/default) declared in the application and "Multilingual" property set to 'true'. However, my main problem here is that language change is not working.

I have taken Embedded Wizard own example project called "Menus" as reference to implement my menu. So, I have a class "DeviceClass" where there is a property called "Language" which is updated when one of the items of the language menu is selected by outlet properties. The onset method of the property is as follows:

// The property doesn't change -> nothing to do.
if ( pure Language == value )
  return;

// Remember the new value in the internal memory of the property.
pure Language = value;

// The property doesn't change -> nothing to do.
if ( pure Language == value )
  return;

// Remember the new value in the internal memory of the property.
pure Language = value;

// Immediatelly update the UI language
if ( value == 1 ) language = Spanish;
else              language = Default;

$if $prototyper
  trace "Change language to", language;
$endif

// Notify all associated property observers.
notifyobservers ^Language;

And I also included the next "UpdateLanguage()" method with expected argument 'aNewValue':

// Only if the reported value does differ from the one stored currently in the property.
if ( aNewValue != pure Language )
{
  // Remember the new value in the internal memory of the property.
  pure Language = aNewValue;

  // Immediatelly update the UI language
  if ( aNewValue == 1 ) language = Spanish;
  else                  language = Default;

  // Notify all associated property observers.
  notifyobservers ^Language;
}

In the application, all "Text" components' caption contain string constants that include different values for each language. And the case is that property "Language" is being updated properly, but texts stay the same when a new language is selected. I have read all available documentation and doubts in the forum related to language change, but I still cannot figure out what I am doing wrong.

I may need here some help to solve this issue. What can I do?

Thank you in advance and regards,

Fayna

1 Answer

+1 vote
by
 
Best answer

Hello Fayna,

I don't know whether it is the cause of the problem, but the first implementation from your question above contains an error. The if-condition is repeated twice resulting in the second condition being always fulfilled:

// The property doesn't change -> nothing to do.
if ( pure Language == value )
  return;

// Remember the new value in the internal memory of the property.
pure Language = value;

// -----------------------------------
// Following condition is always true.
// -----------------------------------
if ( pure Language == value )
  return;

// Remember the new value in the internal memory of the property.
pure Language = value;

Possibly you have copy-pasted it twice?

Best regards

Paul Banach

by

Hi Paul,

Thanks for your help. I did not notice the doubled snippet of code, shame on me! I removed that part and now language is changing, but not as I expected. I appreciate two issues:

1. In the project examples I have checked, texts are updated automatically when new language is selected, including current dialog. In my case, the menu where language is selected does not change instanly, but if I exit and access back the same menu, then texts are presented in the selected language. Is this the proper behavior? 

2. In the following picture, you may see my menu tree structure, where "SETTINGS" is the main menu or entry point from which the rest of menues ("UNITS", "LANGUAGE", "TIME & DATE") and submenues can be accessed. In addition to issue 1, when new language is selected in "LANGUAGE", texts of all menues and submenues are updated correctly, excepting the ones included in "SETTINGS", which always stay in English/default language. Is there a way to make "SETTINGS" texts get updated?

Once again, thank you very much in advance and kind regards,

Fayna

by

Hello Fayna,

I suppose, the components (e.g. for the menu SETTINGS) have not set the attribute MultiLingual = true. Generally, the attribute has to be set for each component (class) containing embedded objects (e.g. menu items) which are configured with multi-lingual expressions. Can you check whether all menu components are configured property with MultiLingual = true?

Best regards

Paul Banach

 

by
Hi Paul,

As you mentioned, the problem was that not all components had Multilingual attribute set to the proper value. Now it seems to work! Thank you for your help and patience.

Regards,

Fayna

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...