×
Namespaces

Variants
Actions

How to solve problems localizing the app name

From Nokia Developer Wiki
Jump to: navigation, search

This article gives hints how to find the reason for problems localizing a Windows Phone App's title text.

WP Metro Icon UI.png
SignpostIcon XAML 40.png
WP Metro Icon WP8.png
SignpostIcon WP7 70px.png
Article Metadata
CompatibilityArticle
Created: influencer (25 Nov 2012)
Last edited: hamishwillee (04 Nov 2013)

Contents

Introduction

Localizing an app can be a rewarding but also a complicated task. MSDN has documentation on three different aspects of the localization:

  • localizing the app resources
  • handling the application bar
  • and translating the app name and tile title.


Especially the last point presented a lot of problems to me and other developers.

Note.pngNote: The localization worked in both a WP 7.5 app and a WP8 version.

Translating the app title

There's a detailed step-by-step description on MSDN about how to localize the app title of a Windows Phone app. There's also a tool by Patrick Getzmann that automates generating the necessary C++-DLLs.

In order to localize the app title it's necessary to create a resource-only C++ DLL for each language that's to be supported. The DLL contains a string table that has one text for the app title and one for the app's text when pinned to the start screen. In the app manifest the unlocalized strings are replaced by references to the DLL's resources.

  <App xmlns="" ProductID="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" Title="@AppResLib.dll,-100"
RuntimeType="Silverlight" Version="1.0.0.0" Genre="apps.normal" Author="Thomas Schmidt"
Description="Sample app" Publisher="Thomas Schmidt">

...

    <Tokens>
<PrimaryToken TokenID="KeyRingToken" TaskName="_default">
<TemplateType5>
<BackgroundImageURI IsRelative="true" IsResource="false">Images\appimage.png</BackgroundImageURI>
<Count>0</Count>
<Title>@AppResLib.dll,-200</Title>
</TemplateType5>
</PrimaryToken>
</Tokens>

Problem happening

I proceeded according to the documentation and began testing with the emulator and on the Lumia device. I had created my default language DLL named AppResLib.dll with German texts and an English version called AppResLib.dll.0409.mui.

Then I changed the emulator to English display language and voilà, the app had an English name. So far so good. But when I changed back to German the app kept the English name. Trying the same on the device got me the same result. I don't know how often I switched languages back and forth without effect.

Looking for advice

I searched for a while and found many reports of other developers facing the same problem. Even one of my colleagues talked about it regarding one of his apps.

The hints I found ranged from

  • using only neutral language IDs (like German - warning, in my understanding this is incorrect!) to
  • only using specific language IDs (like German-Germany - the correct way) to
  • always using English-US as default language (this is not necessary - works with DE-de in my app). Nevertheless this is advisable as any users in unsupported languages will see the neutral language.
  • One other tip was to change the neutral language id in the app properties.
  • The list of supported languages in the xml representation of the VS project file is another item of discussion. This has to be done in Notepad for WP7 apps. Visual Studio has a dialog representation for this.
  • An important tip is not to forget to set the DLLs to 'Content'.
  • Some threads discussing the problem were even removed from the MSDN forums.


I tried all these tips. I experimented with the language IDs of the resources in the DLLs themselves but that didn't help either. The whole experience was very frustrating after some days.

My solution

I searched again and meanwhile the wp8 SDK was published. A new MSDN article has appeared and an accompanying sample was published. I installed the sample although I can't run it (my notebook doesn't support Hyper-V and I don't own a WP8 device yet). In the sample I saw that there were resource DLLs for each supported language with the .mui extension (including the default language) plus the DLL for the default language with the .dll extension.

I tried this approach in my app and suddenly the language switching succeeded!

Here's a list of the included resource DLLs in my app project that's localized in German and English:

  • AppResLib.dll
  • AppResLib.dll.0407.mui
  • AppResLib.dll.0409.mui

Another catch

Today I stumbled across another hurdle. Localizing my app for Spanish, I again didn't get the app title to translate. For Spanish there is a specialty: the locale 'es-ES' is associated with two different locale IDs (LCIDs), 1034 (0x40a) and 3082 (0xc0a). They differ in the sorting rules, the first being called 'Spanish traditional' and the second 'Spanish international'. On Windows Phone the international variant has to be used, so the DLL has to be called AppResLib.dll.0c0a.mui!

There is another occurence of the Spanish language available as UI language on Windows Phone 8, 'es-MX', Mexican Spanish. If the device UI is in Mexican Spanish, the store shows the app with its Spanish name. So far so good. Installing it results in the English name to be used, as the app's neutral language is English and 'es-MX' is not matched by 'es-ES'. Looks like the store matches any available incarnation of the same language while the app loader on the phone uses another algorithm. I don't know if this is a bug or expected behaviour but the solution seems to be to add 'es-MX' to my localizations. I'll try that and report.

This page was last modified on 4 November 2013, at 09:04.
379 page views in the last 30 days.