Reputation: 65
I am developing a UWP app and I liked that I was available in several languages. I'm using visual studio 2015, how do I do this?
Upvotes: 0
Views: 1726
Reputation: 1076
Firstly, create the following folder structure in your app project:
\Strings
\Strings\en-US
\Strings\it-IT
Then add a new file: Resources.resw
in each of the last two folders which type is Resource File
,
Add a TextBlock
control in the main page, set the property x:Uid="TextWelcome"
, then in each Resources.resw
, add a new item:
Name: TextWelcome.Text
Value: (your localized string)
Build and launch app, change the culture of your machine, then check the localized version of your app.
Here is an article and a sample app project for your reference:
Windows 10 Development - Localization
Sample app - Localization in Windows 10
Upvotes: 0
Reputation: 1879
good start: https://learn.microsoft.com/en-us/windows/uwp/globalizing/globalizing-portal
in essence: set x:Uid element in your xaml. In your resource file do [x:Uid].[PropertyName]
so for example:
in resource file the key for the text proeprty will be tb1.Text
Upvotes: 3