locked
Windows store app can not dynamic load or replace the Resources.resw file, and xmal not support DynamicResource!!!

    Question

  • 1. When i use Resources.resw Localization(Windows store app)

        Resources.resw can not dynamic load or replace. so i can not change the display language of UI when it running.

    2. When I use ResourceDictionary files in .xmal Localization(Windows store app)

        but windows store app not support DynamicResource.


    3. In WPF i can use ResourceDictionary(in .xaml), it can do well!!!

     use DynamicResource:

    <TextBlock x:Name="textblock_option_zhcn" Text="{DynamicResource LanguageOptionChinese}" FontSize="22"/>



        1. project/Resources/local/en-US.xaml

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:system="clr-namespace:System;assembly=mscorlib">
        <system:String x:Key="AppTitle">Localized multi-language demo</system:String>
        <system:String x:Key="LanguageMenuHeader">Languages</system:String>
        <system:String x:Key="LanguageOptionEnglish">English</system:String>
        <system:String x:Key="LanguageOptionChinese">Chinese</system:String>
        <system:String x:Key="LanguageCurrent">Current Language:</system:String>
        <system:String x:Key="LanguageChange">Change Language</system:String>
    </ResourceDictionary>




        2. project/Resources/local/zh-CN.xaml

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                        xmlns:system="clr-namespace:System;assembly=mscorlib">
        <system:String x:Key="AppTitle">本地化多语言示例</system:String>
        <system:String x:Key="LanguageMenuHeader">语言</system:String>
        <system:String x:Key="LanguageOptionEnglish">英文</system:String>
        <system:String x:Key="LanguageOptionChinese">中文</system:String>
        <system:String x:Key="LanguageCurrent">当前语言:</system:String>
        <system:String x:Key="LanguageChange">语言更改</system:String>
    </ResourceDictionary>


    Windows store app how to dynamic change the language when app running?




    • Edited by oneonce Tuesday, March 3, 2015 3:56 PM r
    Tuesday, March 3, 2015 3:38 PM

Answers

  • Hi oneonce,

    Why do you need ResouceDictionary to set the language, if you need multi-language supported, see this for more information: Quickstart: Translating UI resources

    If you would like to change the language at runtime, try following code:

    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = new_language_here;

    var resourceContext = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView(); resourceContext.Reset();

    and then force the page to reload itself.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 4, 2015 8:02 AM
    Moderator

All replies

  • Hi oneonce,

    Why do you need ResouceDictionary to set the language, if you need multi-language supported, see this for more information: Quickstart: Translating UI resources

    If you would like to change the language at runtime, try following code:

    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = new_language_here;

    var resourceContext = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView(); resourceContext.Reset();

    and then force the page to reload itself.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 4, 2015 8:02 AM
    Moderator
  • Hi oneonce,

    Why do you need ResouceDictionary to set the language, if you need multi-language supported, see this for more information: Quickstart: Translating UI resources

    If you would like to change the language at runtime, try following code:

    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = new_language_here;

    var resourceContext = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView(); resourceContext.Reset();

    and then force the page to reload itself.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Hi James

    Thank you very much, so exciting!

    Wednesday, March 4, 2015 8:29 AM
  • Hi oneonce,

    Why do you need ResouceDictionary to set the language, if you need multi-language supported, see this for more information: Quickstart: Translating UI resources

    If you would like to change the language at runtime, try following code:

    Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = new_language_here;

    var resourceContext = Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView(); resourceContext.Reset();

    and then force the page to reload itself.

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Hi James

    Thank you very much, so exciting!

    It would be nice if the UI can be updated immediately. android can do it.

    Maybe it needs to improve the Windows app stores, and support dynamic load DLLs.

    Thursday, March 5, 2015 12:42 AM
  • Hi oneonce,

    Thanks for your suggestion, however I cannot find a easier way to implement this for this moment.

    Here is our feedback channel if you would like suggest your idea with our product team: https://wpdev.uservoice.com/forums/110705-dev-platform

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, March 5, 2015 1:29 AM
    Moderator
  • Hi oneonce,

    Thanks for your suggestion, however I cannot find a easier way to implement this for this moment.

    Here is our feedback channel if you would like suggest your idea with our product team: https://wpdev.uservoice.com/forums/110705-dev-platform

    --James


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Hi James,

        Thanks for your reply!!

        My English is not good, I will try to do it.

    • Marked as answer by oneonce Friday, March 6, 2015 9:18 AM
    • Unmarked as answer by Jamles HezModerator Monday, March 9, 2015 2:00 AM
    Thursday, March 5, 2015 9:57 AM