Localization for subcultures on WP7 does not receive

I'm trying to localize my wp7 application, and I need to have different lines for de-DE and de-AT , because there are differences between the languages ​​between the two cultures, although the basic settings are the same.

To do this, I did the following:

  • Created AppResources.resx file for default text text
  • Created the file AppResources.de-DE.resx for German text
  • Created the file AppResources.de-AT.resx for German text for the Austrian subculture
  • in the assembly Information ... in the project properties I set English as my neutral language
  • I closed the solution, opened my project.csproj file and changed <SupportedCultures/> to the following: <SupportedCultures>de-AT;de-DE</SupportedCultures>
  • I added a new LocalizedStrings class, registered it with Application.Resources in App.xaml and changed the output line accordingly.

Both emulators as a handset are installed in the Austrian language, System.Globalization.CultureInfo.CurrentCulture.ToString(); returns de-AT , but regardless of whether the texts defined in AppResources.de-DE.resx , and not those defined in the file for Austrian culture.

How can I solve this problem?

+4
source share
1 answer

You should check CultureInfo.CurrentUICulture , not CurrentCulture!

This is a property that controls resource loading for an interface!

The value of CurrentUICulture should correspond to the value selected in the settings of the phone / emulator Settings β†’ Region + Language β†’ Display language.

Ideally, you can always override the system imposed by CurrentUICulture by setting another CultureInfo to Thread.CurrentUICulture .

+1
source

All Articles