• AVR Freaks

Hot!Harmony's graphics example, boot default display language switching method

Author
PSIR
New Member
  • Total Posts : 29
  • Reward points : 0
  • Joined: 2018/05/27 19:05:17
  • Location: 0
  • Status: offline
2018/06/25 20:05:10 (permalink)
0

Harmony's graphics example, boot default display language switching method

Hello everyone:
There is a aria_weather_forecast weather forecast sample in Harmony's following installation directory, located in the following location:
 
Harmony\v2_06\apps\gfx\aria_weather_forecast
 
This is an example of a three-nation language. It is available in English, Simplified Chinese, and Spanish. Originally it was English when it was switched on. How do I change the default language for startup to Spanish?
Thank you.
#1

8 Replies Related Threads

    Ed@Microchip
    Super Member
    • Total Posts : 152
    • Reward points : 0
    • Joined: 2017/04/06 09:39:29
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2018/06/26 09:45:30 (permalink)
    0
    In MHGC (Graphics Composer), go to Asset -> Strings to open the String Table Configuration dialog box.
     
    In the Language Definitions tab, select the "Spanish" row and click Select as Default Language (A) button. Regenerate, rebuild and program to the board.
     
    OR,
     
    You can manually modify libaria_initiaize() in libaria_init.c and add
     


    GFX_Set(GFXF_DRAW_PIPELINE_MODE, GFX_PIPELINE_GCUGPU);

    laContext_SetStringTable(&stringTable);

    + laContext_SetStringLanguage(language_Spanish);
    +

    screen = laScreen_New(LA_FALSE, LA_FALSE, &ScreenCreate_SplashScreen);

    laContext_AddScreen(screen);

     
     
    #2
    PSIR
    New Member
    • Total Posts : 29
    • Reward points : 0
    • Joined: 2018/05/27 19:05:17
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2018/06/27 00:39:08 (permalink)
    0
    I have tried both of the above methods. The program of libaria_initiaize() in libaria_init.c has also changed. However, it still shows English when it is turned on and does not show Spanish.
    Thanks for help.
     
    #3
    Ed@Microchip
    Super Member
    • Total Posts : 152
    • Reward points : 0
    • Joined: 2017/04/06 09:39:29
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2018/06/27 09:48:43 (permalink)
    0
    Looks like the order when the SetStringLanguage() is called during initialization is incorrect, we'll fix this in future Harmony releases.
     
    In the meantime, you will need to move the call to laContext_SetStringLanguage() after laContext_SetActiveScreen(0) in libaria_initialize().
     
     
        laContext_SetActiveScreen(0);
       
    +    laContext_SetStringLanguage(language_Spanish);
    #4
    PSIR
    New Member
    • Total Posts : 29
    • Reward points : 0
    • Joined: 2018/05/27 19:05:17
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2018/06/27 18:54:27 (permalink)
    0
    Dear Sir:
     
    I moved this statement below, from the original location.
    laContext_SetStringLanguage(language_Spanish);
     
    into after this statement below.
    laContext_SetActiveScreen(0);

    It's work, booting changes the default language.
    It's very helpful, Thank you for your help.
     
    libaria_initiaize() in libaria_init.c has changed as follows:

    //    laContext_SetStringLanguage(language_Spanish);    //origion
        
        screen = laScreen_New(LA_FALSE, LA_FALSE, &ScreenCreate_SplashScreen);
        laContext_AddScreen(screen);

        screen = laScreen_New(LA_FALSE, LA_FALSE, &ScreenCreate_MainScreen);
        laContext_AddScreen(screen);

        laContext_SetActiveScreen(0);
        laContext_SetStringLanguage(language_Spanish);  //move to here

        return 0;

    #5
    Szuszu
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2019/08/02 01:23:24
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2019/10/07 03:22:41 (permalink)
    0
    hi Sir,
     
    I've problem with language changing. Solution described above works fine, but I want to change language in run-time.  After this simple code run, the system will restart, but with the same language as before. Thanks for help.
     
     
    void btn_settings_langYes_PressedEvent(laButtonWidget* btn) {

    uint32_t language = laContext_GetStringLanguage();

    if (language == language_English) {
    laContext_SetStringLanguage(language_Hungarian);
    } else {
    laContext_SetStringLanguage(language_English);
    }}

    #6
    Ed@Microchip
    Super Member
    • Total Posts : 152
    • Reward points : 0
    • Joined: 2017/04/06 09:39:29
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2019/10/07 12:09:13 (permalink)
    0
    It's probably running into an exception somewhere, that's why it restarts. Check with the debugger where the exception happens.
     
    #7
    Szuszu
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2019/08/02 01:23:24
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2019/10/08 02:34:56 (permalink)
    0
    Thanks Ed!
     
    i have a general exception handler, so I thought restarting is a normal flow...
    After debugging the changing process, I found a widget on the actual screen , that occurs the problem. As a solution for now, first I switch the main screen (from Settings screen) and then the laContext_SetStringLanguage(idx) works fine. I mean, that the problem is with the child-child widget pairs:
    rb_DHCP = laRadioButtonWidget_New();
    laWidget_SetPosition((laWidget*)rb_DHCP, 15, 300);
    laWidget_SetSize((laWidget*)rb_DHCP, 195, 35);
    laWidget_SetBackgroundType((laWidget*)rb_DHCP, LA_WIDGET_BACKGROUND_NONE);
    laWidget_SetBorderType((laWidget*)rb_DHCP, LA_WIDGET_BORDER_NONE);
    laRadioButtonWidget_SetText(rb_DHCP, laString_CreateFromID(string_settings_rb_DHCP));
    laRadioButtonWidget_SetHAlignment(rb_DHCP, LA_HALIGN_LEFT);
    laRadioButtonWidget_SetImagePosition(rb_DHCP, LA_RELATIVE_POSITION_RIGHTOF);
    laRadioButtonGroup_AddButton(radioButtonGroup_1, rb_DHCP);
    laRadioButtonWidget_SetSelectedEventCallback(rb_DHCP, &rb_DHCP_CheckedEvent);
    laRadioButtonWidget_SetDeselectedEventCallback(rb_DHCP, &rb_DHCP_UnselectedEvent);
    laWidget_AddChild((laWidget*)gb_settings_network, (laWidget*)rb_DHCP);
    btn_settings_DHCP = laButtonWidget_New();
    laWidget_SetPosition((laWidget*)btn_settings_DHCP, -15, -20);
    laWidget_SetSize((laWidget*)btn_settings_DHCP, 205, 70);
    laWidget_SetBackgroundType((laWidget*)btn_settings_DHCP, LA_WIDGET_BACKGROUND_NONE);
    laWidget_SetBorderType((laWidget*)btn_settings_DHCP, LA_WIDGET_BORDER_NONE);
    laButtonWidget_SetPressedEventCallback(btn_settings_DHCP, &btn_settings_DHCP_PressedEvent);
    laButtonWidget_SetReleasedEventCallback(btn_settings_DHCP, &btn_settings_DHCP_ReleasedEvent);
    laWidget_AddChild((laWidget*)rb_DHCP, (laWidget*)btn_settings_DHCP);
     
     
    Thanky you again for the enlightening.
     
    #8
    Szuszu
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2019/08/02 01:23:24
    • Location: 0
    • Status: offline
    Re: Harmony's graphics example, boot default display language switching method 2019/10/08 02:36:13 (permalink)
    0
    Thanks Ed!
     
    i have a general exception handler, so I thought restarting is a normal flow...
    After debugging the changing process, I found a widget on the actual screen , that occurs the problem. As a solution for now, first I switch the main screen (from Settings screen) and then the laContext_SetStringLanguage(idx) works fine. I mean, that the problem is with the child-child widget pairs:
    rb_DHCP = laRadioButtonWidget_New();
    laWidget_SetPosition((laWidget*)rb_DHCP, 15, 300);
    laWidget_SetSize((laWidget*)rb_DHCP, 195, 35);
    laWidget_SetBackgroundType((laWidget*)rb_DHCP, LA_WIDGET_BACKGROUND_NONE);
    laWidget_SetBorderType((laWidget*)rb_DHCP, LA_WIDGET_BORDER_NONE);
    laRadioButtonWidget_SetText(rb_DHCP, laString_CreateFromID(string_settings_rb_DHCP));
    laRadioButtonWidget_SetHAlignment(rb_DHCP, LA_HALIGN_LEFT);
    laRadioButtonWidget_SetImagePosition(rb_DHCP, LA_RELATIVE_POSITION_RIGHTOF);
    laRadioButtonGroup_AddButton(radioButtonGroup_1, rb_DHCP);
    laRadioButtonWidget_SetSelectedEventCallback(rb_DHCP, &rb_DHCP_CheckedEvent);
    laRadioButtonWidget_SetDeselectedEventCallback(rb_DHCP, &rb_DHCP_UnselectedEvent);
    laWidget_AddChild((laWidget*)gb_settings_network, (laWidget*)rb_DHCP);
    btn_settings_DHCP = laButtonWidget_New();
    laWidget_SetPosition((laWidget*)btn_settings_DHCP, -15, -20);
    laWidget_SetSize((laWidget*)btn_settings_DHCP, 205, 70);
    laWidget_SetBackgroundType((laWidget*)btn_settings_DHCP, LA_WIDGET_BACKGROUND_NONE);
    laWidget_SetBorderType((laWidget*)btn_settings_DHCP, LA_WIDGET_BORDER_NONE);
    laButtonWidget_SetPressedEventCallback(btn_settings_DHCP, &btn_settings_DHCP_PressedEvent);
    laButtonWidget_SetReleasedEventCallback(btn_settings_DHCP, &btn_settings_DHCP_ReleasedEvent);
    laWidget_AddChild((laWidget*)rb_DHCP, (laWidget*)btn_settings_DHCP);

     
     
    Thanky you again for the enlightening.
     
    #9
    Jump to:
    © 2019 APG vNext Commercial Version 4.5