If you’re working on a Silverlight application for WP7 and you want to localize non only the resources inside the application, but also the Title name of your application you could find some useful information on this post that make your app easily uploaded and certified on the App Hub (the marketplace).
The result of you localization process will be as the following, in the emulator (you can test this on it) you’ll see the same app using different names for English, Italian, French, Spanish and German.
In the following pictures you can see the difference, switching between English and Italian.
To switch, you have to go in settings menu of your emulator (or device) and change the language and than tap to screen to reboot it using the new configuration.
How to localize
Basically to localize the Title you have to create a resource-only project for the following languages in C++, build and add the assemblies to the root of you Silverlight project. To do this you have to use Visual C++ compiler (unfortunately the Visual C++ Express can’t be used, but if haven’t a full copy of Visual Studio 2010 you can download a trial).
I’ve create a simple Silverlight project and the resource-only C++ projects that you can download and easily personalize.
You can see in following picture how it looks like:
The WP7SilverlightLocalizedSample depends on some C++ projects. You hadn’t to rename the C++, projects, they must be named exactly as they are, instead you can add you personal Silverlight project to the Solution.
Every C++ project have some post-built rules that copy the resource assemblies in the root of the solution. In the Silverlight project I have “add a link” to the generated assemblies and I’ve set the properties for these seven files as “Content” in the Build Actions.
If you now want to localize the names of your application in different languages, first start from the AppResLib, and right-click on the AppResLib.rc file , than view code, and you’ll enter in the resource file.
The AppResLib is the assembly for the language-neutral.
In the resource file you can search for the two string “AppTitle” and “AppTileString” and change them as you prefer.
You have to do the same stuff for other assemblies:
- AppRes0407 for German
- AppRes0409 for English - United States
- AppRes040c for French
- AppRes0410 for Italy
- AppRes0809 for English – UK
- AppRes0c0a for Spanish
How to setup the Silverlight Project
Now that you have localized the resource-only assemblies you have to change the WMAppManifest.xml , that you probably have on the properties folder and change the two strings as in the following pictures:
So you have to put in App element the Title attribute as
and the Title element in the TemplateType5 as
and you’ve done!
If you want to localize the title of your Silverlight app for the marketplace you can use the sample I provided, if you’re using XNA for building game you can see the detailed Aaron Stebner’s post from here.
Happy coding with Windows Phone 7.