How to localize the title of a Windows Phone game created with XNA Game Studio 4.0

Note - there is now a simpler set of steps to create a game with a localized title, and I have written a newer blog post with updated steps. Please refer to https://blogs.msdn.com/b/astebner/archive/2010/12/10/10103522.aspx for more details.

Recently, a user posted a question on the XNA forums asking how to localize the name of their Windows Phone game.  They were attempting to follow the How to: Localize an Application Title for Windows Phone tutorial in the Windows Phone documentation, but were running into some issues.  That tutorial contains instructions for localizing the title of a Silverlight application, but the steps are a bit different for XNA games.  I also found some of the steps to be vague and/or confusing while I tried to work through them on my own.

I’ve created an updated set of steps that can be used to localize the name of a Windows Phone game created with XNA Game Studio 4.0.  I also uploaded a sample solution that implements these steps.

The steps below and the sample solution that I have created both require that you use Visual Studio 2010 Professional, Premium or Ultimate because the steps require a version of Visual Studio that supports creating a solution that contains both C++ and C# projects.  The VS 2010 Express Editions do not support this.

Step 0 – Create a Windows Phone game project

  1. Start Visual Studio 2010.
  2. Click on File | New | Project..., select Visual C# | XNA Game Studio 4.0 and choose Windows Phone Game (4.0).

Step 1 – Create a language-neutral native resource DLL

Note - the name of the native resource DLL is important in this scenario.  It must be named AppResLib.dll, and the localized versions must be named AppResLib.dll.*.mui.  If they are named differently, your game will be rejected by the Windows Phone Marketplace certification process. 

  1. Right-click on the solution that contains your Windows Phone Game project and choose Add | New Project...

  2. Select Visual C++ | Win32 | Win32 Project and name it AppResLib.

  3. In the Win32 Application Wizard, select DLL and check the Empty Project check box, then click Finish.

  4. Right-click on the AppResLib project in the Visual Studio solution explorer and choose Properties.

  5. Change the Configuration drop-down from Active (Debug) to All Configurations.

  6. Expand Configuration Options | Linker and click on Advanced.

  7. Set the No Entry Point value to Yes (/NOENTRY) and click OK.

  8. Right-click on the AppResLib project in the Visual Studio solution explorer and choose Add | Resource...

  9. Click on String Table and then click New.

  10. Add two strings to the string table with the following IDs:

    AppTitle
    AppTileString

  11. Set the AppTitle value to 100 and set the caption to the language-neutral name of your game that will be displayed in the Games Hub or the Application List.

  12. Set the AppTileString value to 200 and set the caption to the language-neutral name of your game that will be displayed when the game is pinned to the Windows Phone start menu.

  13. Build the AppResLib project.

Step 2 – Create an English (US) native resource DLL

  1. Right-click on the solution that contains your Windows Phone Game project and choose Add | New Project...

  2. Select Visual C++ | Win32 | Win32 Project and name it AppRes0409.

  3. In the Win32 Application Wizard, select DLL and check the Empty Project check box, then click Finish.

  4. Right-click on the AppRes0409 project in the Visual Studio solution explorer and choose Properties.

  5. Change the Configuration drop-down from Active (Debug) to All Configurations.

  6. Expand Configuration Options | Linker and click on Advanced.

  7. Set the No Entry Point value to Yes (/NOENTRY) .

  8. Expand Configuration Options | Resources and click on General.

  9. Set the Culture value to English (United States) (0x409) (/l 0x0409) .

  10. Expand Configuration Options | Build Events and click on Post-Build Event.

  11. Set the Command Line value to the following:

    copy "$(OutputPath)$(ProjectName).dll" "$(OutputPath)\AppResLib.dll.0409.mui"

  12. Right-click on the AppRes0409 project in the Visual Studio solution explorer and choose Add | Resource...

  13. Click on String Table and then click New.

  14. Add two strings to the string table with the following IDs:

    AppTitle
    AppTileString

  15. Set the AppTitle value to 100 and set the caption to the English (United States) name of your game that will be displayed in the Games Hub or the Application List.

  16. Set the AppTileString value to 200 and set the caption to the English (United States) name of your game that will be displayed when the game is pinned to the Windows Phone start menu.

  17. Build the AppRes0409 project.

Step 3 – Create native resource DLLs for other supported languages

  1. Repeat Step 2 and create the resource-only DLL for English (United Kingdom). Set the Resource Culture to English (United Kingdom) (0x809) (/l 0x0809) and update the post-build event command line to rename the DLL file to AppResLib.dll.0809.mui.
  2. Repeat Step 2 and create the resource-only DLL for French (France). Set the Resource Culture to French (France) (0x40c) (/l 0x040c) and update the post-build event command line to rename the DLL file to AppResLib.dll.040c.mui.
  3. Repeat Step 2 and create the resource-only DLL for Italian (Italy). Set the Resource Culture to Italian (Italy) (0x410) (/l 0x0410) and update the post-build event command line to rename the DLL file to AppResLib.dll.0410.mui.
  4. Repeat Step 2 and create the resource-only DLL for German (Germany). Set the Resource Culture to German (Germany) (0x407) (/l 0x0407) and update the post-build event command line to rename the DLL file to AppResLib.dll.0407.mui.
  5. Repeat Step 2 and create the resource-only DLL for Spanish (Spain). Set the Resource Culture to Spanish (Spain) (0xc0a) (/l 0x0c0a) and update the post-build event command line to rename the DLL file to AppResLib.dll.0c0a.mui.

Step 4 – Add native resource DLLs to your Windows Phone game project

  1. Right-click on your Windows Phone game project in the Visual Studio solution explorer, click Add | Existing Item...
  2. Browse to the file named AppResLib.dll that you built in step 2 above, click the down arrow next to the Add button, and then select Add as Link.
  3. Browse to each of the files named AppResLib.dll.*.mui that you built in steps 3 and 4 above, click the down arrow next to the Add button, and then select Add as Link.
  4. For each of the AppResLib.dll* files added as links, set the Build Action property to None and the Copy to Output Directory property to Copy if newer.  This will make sure that each of these files gets packaged into the XAP file that is created when you build your Windows Phone Game project.

Step 5 – Make your Windows Phone game project dependent on the native resource DLL projects

  1. Right-click on the solution that contains your Windows Phone Game project and your resource DLL projects in the Visual Studio solution explorer and choose Project Dependencies...
  2. Select your Windows Phone Game project in the Projects drop-down.
  3. Check all of the check boxes next to your resource DLL projects and click OK.

Step 6 – Update your Windows Phone game to load title strings from the resource DLLs

Update the application title by doing the following:

  1. In your Windows Phone Game project, open the file Properties\AssemblyInfo.cs.

  2. Remove the AssemblyTitle entry.

  3. Add an AssemblyTitleAttribute entry that looks like this:

    [assembly: AssemblyTitleAttribute("@AppResLib.dll,-100")]

Update the tile title by doing the following:

  1. Right-click on your Windows Phone Game project in the Visual Studio solution explorer and choose Properties.

  2. Click on the XNA Game Studio tab.

  3. Change the Tile title value to look like this:

    @AppResLib.dll,-200

The tile title is the name that is displayed if you click and hold on your application/game in the Windows Phone OS and choose to pin it to the start menu.  There is some additional information about these properties and how to configure them in XNA Game Studio games in this documentation topic.  Depending on the scenarios you want to support for your game, it may not be necessary to create separate strings for your application title and tile title.  If you plan to use the same string for both, you do not need to create separate entries in the string table in each of your native resource DLLs in the instructions above.

Step 7 – Rebuild your Windows Phone game solution

Rebuild the solution that contains your Windows Phone Game project and your resource DLL projects.  When doing so, make sure that the Windows Phone Game project is set as the startup project (as opposed to one of the resource DLL projects or your content project).

<update date="10/15/2010"> I found out today that the ingestion process requires that the resource DLL be named AppResLib.dll, so I've updated the steps in this post to reflect that, and I've posted an updated sample solution. </update>

<update date="1/18/2011"> Added a stronger warning about the naming of the DLL needing to exactly match what is listed in the documentation. </update>