A little while ago, I wrote a blog post with a list of steps that you can use to create native resource DLLs so that you can localize the title of your Windows Phone game created with XNA Game Studio 4.0. Today, I found a blog post about a tool that automates the process of creating these native resource DLLs. This tool provides 2 really nice benefits:
- It eliminates the requirement that you have to build your game from an edition of Visual Studio 2010 that supports both C# and C++ development (the VS 2010 Professional or better editions). In other words, this allows you to build a game with a localized title in the free Visual Studio 2010 Express for Windows Phone edition.
- It greatly simplifies the number and complexity of the steps required to enable title localization for your game.
You can find the tool in this blog post. Here is a set of steps that use this tool that you can use in place of the ones I posted in my earlier blog post to enable title localization for your Windows Phone game created with XNA Game Studio 4.0:
Step 0 – Create a Windows Phone game project
- Start Visual Studio 2010 or Visual Studio 2010 Express for Windows Phone.
- Click on File | New | Project…, select Visual C# | XNA Game Studio 4.0 and choose Windows Phone Game (4.0).
Step 1 – Create native resource DLLs using the Windows Phone 7 Title Localizer tool
- Download the Windows Phone 7 Title Localizer tool from the link at the end of the blog post at http://patrickgetzmann.wordpress.com/wp7-localize/.
- Run the Windows Phone 7 Title Localizer tool.
- Enter your language-neutral title strings.
- Enter your translated title strings or use the Translate button in the tool to automatically translate the strings using the Bing translator engine.
- Click the Save DLLs button to create native resource DLLs that contain the strings you have provided.
Step 2 – Add native resource DLLs to your Windows Phone game project
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.
- Right-click on your Windows Phone game project in the Visual Studio solution explorer, click Add | Existing Item…
- Browse to the folder that you saved the DLLs to in step 2 above, select the file named AppResLib.dll, then click the Add button.
- Select each of the files named AppResLib.dll.*.mui in the same folder, then click the Add button.
- For each of the AppResLib.dll* files that you have added to your Windows Phone game project, 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 3 – Update your Windows Phone game to load title strings from the resource DLLs
Update the application title by doing the following:
- In your Windows Phone Game project, open the file Properties\AssemblyInfo.cs.
- Remove the AssemblyTitle entry.
- Add an AssemblyTitleAttribute entry that looks like this:
Update the tile title by doing the following:
- Right-click on your Windows Phone Game project in the Visual Studio solution explorer and choose Properties.
- Click on the XNA Game Studio tab.
- Change the Tile title value to look like this:
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 4 – Rebuild your Windows Phone game solution
Rebuild the solution that contains your Windows Phone Game project.
<update date=”1/18/2011″> Added a warning about the naming of the DLL needing to exactly match what is listed in the documentation. </update>