78 views
in GUI Development by
Hi, EW team:

     My project has to support multi-language, and some GUI components have to adapt to the language at the same time. So one style is defined to assist one language. The question is how to refresh current screen fully and immediately on changing language and style from background?

   Thank you.

Best regards.

Stephen.

1 Answer

+1 vote
by
 
Best answer

Hello Stephen,

your question as well the usage of Styles to switch languages are not clear to me. Hopefully you will find the answer in following sections:

Managing localization

Managing variants

Please note, in version <= 12 switching Styles had no update effect on already existing (initialized) GUI components. In version 13, the underlying mechanisms have been redesigned. In version 13, switching a Style may very well trigger an update of already existing GUI components. See React automatically to styles alternation for more details.

Best regards

Paul Banach

by
Hi, Paul:

      The shape of some widgets, whose label shows text which has different horizontal size in different language, has to be arranged depending on the language context. So I decided to use variant and style to manage the geometrical differences accompanying language. My project has to support more than 20 languages.

     By the way, the version of EW in my project is 11. I'd like to know how to refresh languge and style with this version.

 

Best regards.

Stephen
by

Your approach sounds very very laborious. I practice you will need to estimate the space for each Text view and each language. I would recommend a more pragmatic approach to adjust the Text views so that all language variants of the respective texts can be shown without being clipped. It means configure the Text views for their maximum size.

Then configure the Text views to align the text inside its area, for example to center the text or align it to the left/right edge. See also: Align the text within the Text view area.

Also, you can configure the Text view to adjust its size automatically to fit to the displayed content. See also Configure the Text view to adjust its size automatically.

If it is inevitable to have the size/position of a Text view depending on the currently selected language, use a constant for this purpose. Configure the constant to have the type rect. Then initialize all language variant specific values of the contents with the individual position/size values. Finally in Inspector window assign this constant in the initialization of the property Bounds of the respective Text view. In this manner, when the language changes, the language specific value from the constant is used and the Text view adjusts its position/size accordingly.

I hope it helps you further.

Best regards

Paul Banach

by
Hi, Paul:

         Your suggestion has helped us a lot.

         I have another requirement in doubt. I have to implement 2 language subsets, one for Europe and the other for Asia. These 2 subsets do not coexist  in generated code for memory space reason. I wonder how I can manage them both in one project while still be able to generate code separately.

         Thank you.

 

Best regards

Stephen
by

Hello Stephen,

in this case you will need to duplicate the Profile member existing in your project. This results in two profiles. The first you use to generate code for Europe and the second profile for Asia. You could name the profiles accordingly, e.g. Profile_Europe and Profile_Asia.

Then select all Language members which are intended to be used in the Europe language subset. Configure the attribute Generator of the selected members to correspond to the name of the 'Europe' profile. Consequently, the languages are generated only when the profile is used.

Similarly, select all Language members to use in the Asia language subset and configure their attribute Generator to be the name of the corresponding profile.

Please note, the language Default should remain enabled for all profiles. 

With this project, switching the profile will enable/disable the languages.

I hope, it addresses your application case.

Best regards

Paul Banach

ago by
Hello, Paul:

       Your suggestion is really helpful to us.

       Thank you.

 

Best regards

Stephen

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

...