Localizing a Windows Phone Game
The title of the game appears in the Application List or Game Hub of the Windows Phone device. It will also appear when the game is pinned to the Start screen.
A localized game title must provide translations for the following languages (for cultures):
- English (United States)
- English (United Kingdom)
- French (France)
- Italian (Italy)
- German (Germany)
- Spanish (Spain)
Localized data are provided within resource-only DLLs, which contain the resource strings for each supported language.
Note
The procedure for localizing a game title on Windows Phone is very similar to the procedure for localizing a Windows Phone application title, but with some important differences.
To localize a game title, perform the following steps:
- Prerequisites
- Create a Language Resource Project and Strings
- Create the First Localized Language Resource Strings
- Create the Remaining Language Resource Strings
- Make the Windows Phone Game Project Dependent on Resource DLL Projects
- Update the Windows Phone Game to Load Localized Title Strings
- Build the Windows Phone Game
Prerequisites
These procedures must be performed on a new or existing Windows Phone project. To create a new project, see Creating a Windows Phone Game or Library Project.
Important
These procedures can only be performed when using Microsoft Visual Studio 2010 Professional, Premium or Ultimate. Solutions that contain both C++ and C# projects, as this feature requires, are not supported in Microsoft Visual Studio Express.
Create a Language Resource Project and Strings
In this procedure, you create a resource-only DLL named AppResLib.dll that contains a resource string table with the language-neutral title of your game.
Important
The DLL you create in this procedure must be named AppResLib.dll.
To create a language resource DLL project
From the File menu, choose New and then click Project.
The New Project dialog appears.
In the left pane, click Installed Templates, expand Visual C++ and then click Win32.
In the list of project types, click Win32 Project and name it AppResLib.
In the Win32 Application Wizard, select DLL and check the Empty Project check box, then click Finish.
In Solution Explorer, select the new DLL project.
From the Project menu, click Properties.
The Property Pages dialog appears.
Change the Configuration drop-down to All Configurations (from Active (Debug)).
In the left pane, expand Configuration Properties, expand Linker, and then click Advanced.
Select the No EntryPoint property, set the value to Yes (/NOENTRY), and click OK.
To create the language-neutral resource strings
In Solution Explorer, select the new DLL project.
From the Project menu, click Add Resource.
The Add Resource dialog appears.
In the Resource type list, select String Table and click New.
The resource string table opens.
Create two resource strings with the following properties:
ID Value Caption AppTitle 100 The language-neutral name of your game to be displayed in the Application List or the Games Hub. AppTileString 200 The language-neutral name of your game to be displayed when the tile is pinned to the Windows Phone Start screen. Save and build the AppResLib project.
Create the First Localized Language Resource Strings
In this procedure, you create a resource string table that contains game title strings specific to a language. The procedure also specifies a post-build event to rename the built DLL correctly as a localized resource and move it to the needed location.
Important
The DLLs containing the localized resource strings must be named in a manner conforming to: where [culture code] is the four-digit culture code of the localized strings.
To create the first specific language resource strings
Follow the steps in the prior procedure to create a new language resource DLL project named AppRes0409 and set its properties.
In the Property Pages dialog, expand Configuration Options, expand Resources, and click General.
Set the Culture value to English (United States) (0x409) (/I 0x0409).
Expand Configuration Options, expand Build Events, and click Post-Build Event.
Set the Command Line value to the following:
copy "$(OutputPath)$(ProjectName).dll" "$(OutputPath)\AppResLib.dll.0409.mui"
In Solution Explorer, select the new DLL project.
From the Project menu, click Add Resource.
The Add Resource dialog appears.
In the Resource type list, select String Table and click New.
The resource string table opens.
Create two resource strings with the following properties:
ID Value Caption AppTitle 100 The English (United States) name of your game to be displayed in the Application List or the Games Hub. AppTileString 200 The English (United States) name of your game to be displayed when the tile is pinned to the Windows Phone Start screen. Save and build the AppRes0409 project.
Create the Remaining Language Resource Strings
This procedure creates the localized resource DLLs for the remaining required languages.
To create the remaining language resource strings
Repeat the previous procedure, creating the following projects and DLLs to support the remaining languages:
Culture | Project Name | DLL File Name |
---|---|---|
English (United Kingdom) (0x809) (/I 0x0809) | AppRes0809 | AppResLib.dll.0809.mui |
French (France) (0x40c) (/I 0x040c) | AppRes040c | AppResLib.dll.040c.mui |
German (Germany) (0x407) (/I 0x0407) | AppRes0407 | AppResLib.dll.0407.mui |
Italian (Italy) (0x410) (/I 0x0410) | AppRes0410 | AppResLib.dll.0410.mui |
Spanish (Spain) (0xc0a) (/I 0x0c0a) | AppRes0c0a | AppResLib.dll.0c0a.mui |
Make the Windows Phone Game Project Dependent on Resource DLL Projects
- In Solution Explorer, right-click the solution that contains your Windows Phone game project and your resource DLL projects and choose Project Dependencies...
- In the Projects drop-down list, select your Windows Phone game project.
- Check all of the check-boxes next to your resource DLL projects and click OK.
Update the Windows Phone Game to Load Localized Title Strings
To update the application title
In your Windows Phone game project, in the Properties folder, open the file AssemblyInfo.cs
Delete the AssembyTitle entry.
Add an AssemblyTitleAttribute entry:
[assembly: AssemblyTitleAttribute("@AppResLib.dll,-100")]
To update the tile title
In Solution Explorer, select the Windows Phone game project.
From the Project menu, click Properties.
The Project Designer appears.
Select the XNA Game Studio Properties Page tab.
Change the Tile title value to the following:
@AppResLib.dll,-200
Build the Windows Phone Game
Before building, make sure that the Windows Phone game project (and not one of the resource DLL projects) is set as the startup project.
Save and build the Windows Phone game solution (for example, using F6).