WP7 AppResLib DLL Generator

Note: This utility works with both Windows Phone 7 and 8 apps and the maximum length of title strings has been updated to 80 characters.

Nice title, I know... Chances are you won't be interested in this, but someone dropping by from Google or Bing will be grateful for what I offer here. As it happens, I couldn't let my shiny new gadget feel alienated, so I paid off the Microsoft Tax and registered as an official Windows Phone developer, which allowed me to unlock my phone for building applications for it and even do live debugging. I already finished my first app and I have some general best practices to share with you about localization.

My application supports English and Hungarian languages, there is a localization solution in the framework but I didn't use it, I went with a WP7 version of my own that I use in ASP.NET applications. It works from an XML file where each string has a name like ModuleTitle and an arbitrary number of child nodes with language code names (en, da, hu etc) and localized content strings. It doesn't matter here, you solve it any way you want. However, there is only one way to localize the Application Title (in the application list) and Tile Title (when you pin it to the home screen) and it's not exactly easy.

In short, you need a resource-only DLL file for each language you want to localize your application for, with two Title strings in each. Generating these resource-only DLL files is quite annoying, especially that you have to do all this typing and renaming all the time whenever you need to make changes, so I made a little tool that does it for you. It works from a project configuration XML file you create with the supported languages and localized strings, which will be inserted into a DLL template file I made without any debug information and 80 characters long placeholders for both Title strings. Just check out the downloaded tool's files, it has a readme, a sample project xml file you can edit and a list of Microsoft assigned Locale IDs you need to use.

After generating the DLL files, copy them into the root directory of your project and add them. The normal AppResLib.dll is the language neutral version, the MUI files are the localized versions. Make sure you open Properties on each of these and set the Build Action as Content so it will be included in your project properly. They will be copied into the XAP file on build, but you need to refer to these resources to actually use them. Open the project properties and see below how you need to set it up:

WP7 application title localization properties
WP7 application title localization properties

As you can see, you have to set the Application Title as @AppResLib.dll,-100 and the Tile Title as @AppResLib.dll,-200 where the numbers are strictly set resource IDs. Sure you can enter these into your WMAppManifest.xml file which you will need to edit anyway before you would release your app.

What you also must set is the Neutral Language of your application. Normally this will be English so you have to set it as plain English, not 'English (United States)' or what have you. If you don't follow this to the letter, you won't see any problem while testing your app, but you will get this error message when the App Hub processes your app's XAP file while uploading it to the Marketplace:

The [NeutralResourceLanguage] attribute is missing on the entry assembly. (2003)

With all these done, your app will work like a charm with the locales you support. If you don't support eg. Italian, you don't have to include the DLL for that language with English titles, in my app I included only the Neutral, US-English and Hungarian files and it's all fine that way. As I see the phone will use the US-English version as a fallback setting if you select a locale you don't support, the Neutral goes unused. Enjoy the generator, I hope it will make your professional life a bit easier.

Update: I had a little oversight in localization. I went for my own string translation solution which is fine, but if you want your application appear in the Marketplace with localized metadata for the supported languages, you must go with the standard localizaton method as well, otherwise you can enter the metadata (description, keywords, images, screenshots) only on the app's neutral language. In my case all I needed was creating a new Resource file for the main project, naming it AppResources.resx (neutral language), then another one named AppResources.hu-HU.resx. I put a test string in each, closed the project, opened the project's .csproj file and entered hu-HU into the SupportedCultures XML node. After this, when I uploaded an updated binary to the Marketplace, it allowed me to enter metadata for both supported languages. It's possible that this last entry on its own controls the supported languages in the Marketplace, but it's not something I want to experiment with.

Windows Phone AppResLib DLL GeneratorResource DLL generator for Windows Phone application title localization. Requires .Net Framework 4.0

« Hungarian Dictionary
Storm Over Budapest »