locked
Change language settings at run time

    Question

  • I read the topic of "How to manage string resources" at http://msdn.microsoft.com/en-us/library/windows/apps/hh465248.aspx and know how to create sources for different language and the respective language resources will be shown according to the default lanauge of the machine. But can I change it to different language other than default language. Let's say, the default language is German but I(user not developer) still want to use English for the app. How can i do that if I don't want to change the default language?


    Great Wall
    Monday, January 2, 2012 9:09 AM

Answers

  • Hi Great,

    If you wish to do something outside of what the system provides, you will need to do this yourself.  You will need to a setting to your application to select the language you want to use and manually change the strings in your application when the user chooses a different language.

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, January 11, 2012 1:39 PM
    Moderator
  • First, let me clarify that the user's language preference is a per-user setting, not a system setting. You may have understood that already, but since you said "the system's preference list", I wasn't sure about that.

    Now, the user's language preference list is their default, and generally it is what will determine the language behaviour in every Metro style app a given user has on their system. And you can change the behaviour of apps by changing the order of languages in your language preference list. Now, we have been looking at supporting a per-app (per-user) language override, so that it would be possible to have a default language preference list but also set a different language as your first preference for a particular app. This wasn't completed for the Developer Preview build, however.

    (Jeff Sanders suggested doing something to store settings yourself. However, if Windows doesn't know what the language preferences are for a given user and app, then some things may not behave properly. For instance, the app tile or a system-provided dialog may appear in the wrong language. For that reason, we want to support the scenario of a user overriding their language preference for particular apps in such a way that the system stores that information rather than the developer storing it in some proprietary way. Again, this wasn't completed for the Developer Preview, but it is something being considered.)

     

    Hope that's of some help.

    Peter


    Monday, January 16, 2012 8:11 AM

All replies

  • Hi GW,

    String resources are meant to work with the default language of the machine.  If you want to do something different, it would be up to you to create this type of functionality yourself.

    -Jeff


    Jeff Sanders (MSFT)
    Tuesday, January 3, 2012 4:07 PM
    Moderator
  • Resource management in Metro style apps is not tied to any notion of "default language of the machine". Rather, the default behaviour for resources in a Metro style app is determined by the user's language preference list. The user sets their language preferences in the Language control panel. In that control panel, a user can indicate all of the languages that they use. These are listed in a priority order. At runtime, the resource management system will compare the user's language preference list with the set of languages for which the app has resources, and will automatically return the resources that provide the best match for the user's preferences. If there's no match, then the developer can indicate the ultimate fallback language from the app's resources to use in that situation.

    Let me know if you need clarification on how to configure the user settings for language.

     

    - Peter

    Thursday, January 5, 2012 6:02 AM
  • let's me elaborate my question. I have a app which supports 4 lanuages and I have all the 4 respective resource strings ready. Now, let's say the system's preference list has german only. But I(user not developer again) as temp user, do want to show the app as english not german. My app will provide this functinality. However, as a developer now, the way I should do according to Peter's suggestion is to add Egnlish into preference list as top, right? Obviousely, this is not the right solution because it changes the system settings and it will impact other apps. Is still something unclear?  
    Great Wall
    Friday, January 6, 2012 8:42 AM
  • Hi Great,

    If you wish to do something outside of what the system provides, you will need to do this yourself.  You will need to a setting to your application to select the language you want to use and manually change the strings in your application when the user chooses a different language.

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, January 11, 2012 1:39 PM
    Moderator
  • First, let me clarify that the user's language preference is a per-user setting, not a system setting. You may have understood that already, but since you said "the system's preference list", I wasn't sure about that.

    Now, the user's language preference list is their default, and generally it is what will determine the language behaviour in every Metro style app a given user has on their system. And you can change the behaviour of apps by changing the order of languages in your language preference list. Now, we have been looking at supporting a per-app (per-user) language override, so that it would be possible to have a default language preference list but also set a different language as your first preference for a particular app. This wasn't completed for the Developer Preview build, however.

    (Jeff Sanders suggested doing something to store settings yourself. However, if Windows doesn't know what the language preferences are for a given user and app, then some things may not behave properly. For instance, the app tile or a system-provided dialog may appear in the wrong language. For that reason, we want to support the scenario of a user overriding their language preference for particular apps in such a way that the system stores that information rather than the developer storing it in some proprietary way. Again, this wasn't completed for the Developer Preview, but it is something being considered.)

     

    Hope that's of some help.

    Peter


    Monday, January 16, 2012 8:11 AM