Aaron Stebner's WebLog

Thoughts about setup and deployment issues, WiX, XNA, the .NET Framework and Visual Studio

Possible workarounds for localization build issues in XNA Game Studio 4.0 Windows Phone games

Possible workarounds for localization build issues in XNA Game Studio 4.0 Windows Phone games

Rate This
  • Comments 0

Recently, we have run into a few issues where XNA Game Studio 4.0 Windows Phone games did not display proper localized strings when changing the phone OS language.  We narrowed down these issues to problems in the game .csproj file that ended up preventing localized resource DLLs from being correctly packaged into the XAP file and deployed to the phone.  These issues are pretty subtle and easy to miss, so I wanted to describe them in a bit more detail in case anyone else runs into these issues in the future.

Note – the issues in this post are specific to XNA Game Studio projects for Windows Phone.  Localized resource DLLs will be correctly packaged in Silverlight projects for Windows Phone regardless of the format that you use for the <SupportedCultures> tag.

Issue 1 – <SupportedCultures> elements are case-sensitive

The list of supported cultures is case-sensitive for XNA Game Studio 4.0 Windows Phone projects.  This means that the cultures that you list in the <SupportedCultures> property in your .csproj file must exactly match the culture names used in the *.resx files in your project and the *.resources.dll files that are built with your project.

For example, if you have a file named strings.fr-FR.resx in your project, you must put the following in your .csproj:

<SupportedCultures>fr-FR</SupportedCultures>

If you put the following in your .csproj instead of what is listed above, then the French strings.resources.dll that is built from strings.fr-FR.resx may not be packaged into the XAP file for your game (which means that the strings will not be available at runtime on the phone after you deploy your game):

<SupportedCultures>fr-fr</SupportedCultures>

Issue 2 – <SupportedCultures> property cannot be split across lines

By default, a new XNA Game Studio 4.0 Windows Phone project includes a blank list of supported cultures that looks like the following:

<SupportedCultures>
</SupportedCultures>

When you add cultures to the <SupportedCultures> property in your .csproj, you must move the closing </SupportedCultures> tag to the same line instead of leaving it on a separate line.  For example:

<SupportedCultures>en;fr;it;de;es</SupportedCultures>

If you put the following in your .csproj instead of what is listed above, then the *.resources.dll files that are built or referenced by your project will not be packaged into the XAP file for your game (which means that the strings will not be available at runtime on the phone after you deploy your game):

<SupportedCultures>en;fr;it;de;es
</SupportedCultures>

Issue 3 – <SupportedCultures> property might not exist in the .csproj

By default, a new XNA Game Studio 4.0 Windows Phone project includes a blank list of supported cultures that looks like the following:

<SupportedCultures>
</SupportedCultures>

However, projects created with previous CTP or beta builds of the Windows Phone Developer Tools will not have a <SupportedCultures> property in the .csproj.  In order to correctly package *.resources.dll files for your game, you will need to add a <SupportedCultures> property to your .csproj and provide the appropriate list of cultures.  You should add the <SupportedCultures> property to the first <PropertyGroup> in your .csproj.

Leave a Comment
  • Please add 4 and 8 and type the answer here:
  • Post