Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localize UWP App

Tags:

uwp

I have a Resource file in a folder Strings and with subfolders for the culture. See this image:

enter image description here

Also in appxmanifest I the default language is set to "en". But unfortunaetly the language doesn't change with the system language.

Did I miss anything?

Link to repo: https://github.com/NPadrutt/MoneyManager

EDIT: As suggested in the comments, adding this line of code to the OnLaunched Method in the App.cs solved thed problem:

        ApplicationLanguages.PrimaryLanguageOverride = GlobalizationPreferences.Languages[0];
like image 653
NPadrutt Avatar asked Oct 25 '15 15:10

NPadrutt


2 Answers

As suggested in the comments, adding this line of code to the OnLaunched Method in the App.cs solved thed problem:

    ApplicationLanguages.PrimaryLanguageOverride = GlobalizationPreferences.Languages[0];
like image 153
NPadrutt Avatar answered Nov 04 '22 16:11

NPadrutt


This isn't tied to the OS system language (language pack) but rather the User's preferred language:

  • Start
  • Settings
  • Time & Language
  • Region & Language
  • Add a Language
  • Set as Default

This will set the language preference for apps without affecting the language of the Windows Shell etc.

Windows has two concepts of Language -- the System Language, which is what the Start Menu, Explorer, and most Win32 apps use, and then the User Preferred Language List, which is what UWP apps use by default. In many cases, System Language == the only language in the UPLL because the user only cares about one language, but if they speak multiple languages then the UPLL can be quite useful. For example, say the user speaks French and Spanish, and their System language is French. Your app is defaulted to English, with a translation to Spanish. If you try and force it to the System language (French), the user will get English (which they don't understand). If you did nothing, they'd get Spanish (which they do understand).

like image 1
Peter Torr - MSFT Avatar answered Nov 04 '22 15:11

Peter Torr - MSFT