How to localize The Title in a WP7 Silverlight application


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.

imageimage

imageimage

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:

image

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.

image

In the resource file you can search for the two string “AppTitle” and “AppTileString” and change them as you prefer.

image

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:

image

So you have to put in App element the Title attribute as

@AppResLib.dll,-100

and the Title element in the TemplateType5 as

@AppResLib.dll,-200

and you’ve done!

Conclusion

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.

Comments (4)

  1. Shawn says:

    Stupid Question, but: "That won't localize it in the marketplace, will it?"

  2. PietroBr says:

    Hi Shawn, when I published my app,I had to do this sfuff and I think today is the same. When you publish your app in the marketplace you can leave different names,descriptions, keywords, screenshots for different markets. But the app's name is not reflected on the device that uses different locations when your users download from marketplace. If you follow the sample I provided you can see the app name changing when you switch between languages on the emulator or devices.

  3. Ramesh says:

    Hi PietroBr Many thanks for posting it.

    Sorry for asking,but "in MS visual studio 2010 Express version" – we do not have the "resource-only project" template in any of the language c++ or C#, Please advise us if anything else we can do to achieve the same 🙂

    Many thanks in advance!!!

    Nice job!

  4. Lomdar67 says:

    Is it possible to get a localized SplashScreen with your method too?

Skip to main content