locked
Problem with Localization in Code RRS feed

  • Question

  • Hello,

    I'm having an issue with the localization in my converters. So, I tried a new project and still have problems.

    So, I created a fresh new Silverlight for Windows Phone application (7.0, but 7.1 don't resolve my problem).

    I added two resources files: Strings.resx and Strings.fr.resx. This two files have two string property: HelloString and ByeString, all initiated correctly.

    Then, I go to the Mainpage.xaml.cs, in the ctor and add the following simple line.

    PageTitle.Text = Strings.HelloString; 

    Whenever I have the emulator or my phone set to English or French, I always got the same strings (Hello). 

    I tried to rename the file Strings.fr-FR.resx. Still the same issue.
    The CurrentUICulture returned from the current thread is correct.
    I also tried to force culture on the resource: 

    Strings.Culture = new System.Globalization.CultureInfo("fr-FR"); 

    Does anyone have an idea?
    Tuesday, September 20, 2011 10:55 AM

Answers

  • In the project properties, you need to set a default language in the "assembly information" button on the application tab. 

    Then you want to close the application,  edit the  project's .csproj file.  Find or add:

    <SupportedCultures>
    fr;
    </SupportedCultures>
    This is working on the assumption that English was set as the default language based on the Strings.fr.resx file you mentioned.
    Tuesday, September 20, 2011 11:25 AM

All replies

  • In the project properties, you need to set a default language in the "assembly information" button on the application tab. 

    Then you want to close the application,  edit the  project's .csproj file.  Find or add:

    <SupportedCultures>
    fr;
    </SupportedCultures>
    This is working on the assumption that English was set as the default language based on the Strings.fr.resx file you mentioned.
    Tuesday, September 20, 2011 11:25 AM
  • It is all described step-by-step in the documentation.
    Tuesday, September 20, 2011 11:32 AM