NPadrutt
NPadrutt

Reputation: 4317

Localize UWP App

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];

Upvotes: 6

Views: 2266

Answers (2)

Peter Torr
Peter Torr

Reputation: 12019

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).

Upvotes: 1

NPadrutt
NPadrutt

Reputation: 4317

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];

Upvotes: 5

Related Questions