Here is how it happens: When Windows Phone 8 starts your app it chooses which AppResources file to use when we access the AppResources class in code. BAM! That is it!
All we have to do at development time is use that class instead of a literal.
In C# instead of:
saveButton.Text = "Save" ;
saveButton.Text = AppResources.SaveButtonText;
When typing the resource name of your choice, in my example "SaveButtonText", you will notice Visual Studio puts a red squiggle underneath the name. It is because you still haven't created the resource. To do that open AppResourcex.resx under "Resource" in solution explorer and add the resource name and value to the list. Once the resource name is entered in the list, the red squiggle disappears and you are good to go.
Lets take a look at XAML as well. Most times XAML is what you will be using. In XAML it is a bit more verbose, but not rocket surgery either:
You can now build and run your app and all should work as it did before we started localizing.
Now go to the Properties page of your project, under "Supported Cultures" , and select which languages and culture will be supported. I started with Portuguese and Spanish. English was already checked.
After making that change and saving visual studio will have created one AppResources.resx file for each culture/language you added. You can now open those and change the values to the values on each specific language.
I may be wrong, but it seems Visual Studio copies the AppResources.resx file from the default language to each new language, so you might want to do this as the very last minute, after your app is ready, or you may need to enter each resource manually on each resx file. Unless there is some sort of refresh functionality I am not aware of.
So in bullet points:
Use AppResource instead of "text"
Create each resource as you go on the default resource file
Choose your languages at the project Properties page
Translate each resource on their language specific resx files.
Done! Easy huh?
Hope this helps some people. As usual, let me know if I screwed up something. Thanks!
Does anyone know whats going on with the formatting?
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.