Multilingual App Toolkit, Pseudo Language and class library

Localizing an application for different languages isn’t easy and it can be time-consuming to make sure that your application looks good in all languages. You might have forgotten to localize strings and have left them hardcoded in your native tongue. Some languages take more space than others and text in these might be truncated in the UI, especially for a smartphone app design. Then there is the issue of keeping track of which text in which language has been updated and signed off, especially if you’re doing a update to the visuals of the app for a new release.

Any help you can get from a tool can potentially save a lot of time in administration and help you fix those “loc bugs” more easily.

If your Windows Phone 8 or Windows Store application is available in multiple languages, or if you’re planning for this, then it’s worth looking into the Multilingual App Toolkit from Microsoft.

The scenario

A WP8 project I was working was undergoing a major visual refresh. It was in the marketplace in several languages. We wanted to track the existing translations (these have been signed-off and should be left unchanged) and mark any new strings as needing translation. We wanted to detect where the designer/dev has hardcoded a string rather than placing it in the localization resources dictionary.

The “MAT” (Multilingual App Toolkit) seemed like a great fit for us – the “pseudo-language” feature in particular would help us spot omissions and truncations more easily.

What is pseudo-language?

Pseudo language is a made up “language” – it mangles your neutral language (in my case, English) and adds padding to make it take more space so that you can 1) tell it’s pseudo language and 2) predict where your truncations will occur. Where English (United Kingdom) is given a ISO language identifier of “en-GB”, pseudo-language is given a language identifier of “qps-PLOC”.

The problem

Our C#/XAML app uses a background agent which we use to generate “toast” text, which is also translated. So to keep a single .resx file that is shared by the application and the background agent, I had followed some advice to place the translation in its own class library. That way we’ve got a single set of strings to translate and they can be used from anywhere in the app – great…

…until I tried to enable the “pseudo-loc” feature in the MAT and get it to display in the WP8 emulator. All other languages were showing up fine apart from pseudo-loc which was stubbornly staying in the neutral language of English.

What is going on?

The localization process works by creating a “satellite assembly” (DLL) that contains your localized resources for each of your target languages. Each satellite assembly has the same name, but they are placed in separate folders in your output directory according to the name of the language’s “culture” or ISO identifier. So, for a “Localization” class library, the English (United Kingdom) satellite assembly “Localization.resources.dll” is placed in the “en-gb” folder.

Looking at the output directories (e.g. bin/Debug) and the unzipping the XAP to look inside it, I could see that in the final application, the satellite assembly for “qps-PLOC” was missing. This is what was stopping strings from showing in Pseudo language. Every other language had copied across fine. I’m not sure exactly why, but I suspect there is a problem with something in the (WP8?) common MSBUILD scripts for Visual Studio 2012 (I haven’t checked for VS2013 yet).

The solution

If I manually edited the XAP to add back the missing file in the path “qps-PLOC/Localization.resources.dll” and ran it on the emulator and the pseudo-language showed correctly.

With a bit of digging around I eventually figured out how to use the MSBUILD build language to add back the missing satellite assembly, so that pseudo-language would work correctly without needing to hack around in the final XAP. It requires an edit to the project of the final Windows Phone XAML app (for C# that’s the .csproj, for VB the .vbproj file). Just before the closing tag insert the following code:

  <PropertyGroup>
    <ComputeIntermediateSatelliteAssembliesDependsOn>
	  $(ComputeIntermediateSatelliteAssembliesDependsOn);AddPseudoLocSatelliteAssemblies
	</ComputeIntermediateSatelliteAssembliesDependsOn>
  </PropertyGroup>
  <Target Name="AddPseudoLocSatelliteAssemblies">
    <ItemGroup>
      <IntermediateSatelliteAssembliesWithTargetPath 
	    Include="$(SolutionDir)\Localization\obj\$(Configuration)\qps-ploc\Localization.resources.dll">
        <Culture>qps-ploc</Culture>
        <TargetPath>qps-ploc\Localization.resources.dll</TargetPath>
      </IntermediateSatelliteAssembliesWithTargetPath>
    </ItemGroup>
  </Target>

You will need to update both the “Include” location and the “TargetPath” above to match the actual path and name of the class library you are using.

Hopefully that help someone else in the same situation!

Paul.

Posted in MSBUILD, Programming, WP8

WordLive now using Sterling database

The 1.3 release now uses a more polished database solution than the one I had previously cooked myself: it’s now using http://www.sterlingdatabase.com/. Hats off to these guys for filling the gap that Microsoft left by currently having no local database API on the phone (1), unlike Android and iPhone which have SQLite APIs (2).

Sterling’s a lot easier to use than SQLite as there are no SQL statements to learn, you just use Plain Old C# Objects (POCOs), which I was already using in the WordLive code. From there you can use LINQ to objects to query your database.

(1) The next Windows Phone platform update “Mango” will have database support and this was discussed at the Mix ‘11 conference  – http://channel9.msdn.com/events/MIX/MIX11/DVC12

(2) It turns out that there is a Windows Phone SQLite port (http://sqlitewindowsphone.codeplex.com/) but it doesn’t look as well supported as Sterling.

Posted in Programming, WP7

WordLive 1.3 released

WordLive 1.3 for Windows Phone is now available as a free application in the Marketplace. This is a bug-fix release sorting out some cosmetic issues with the readings in particular, and removes some error messages received when deleting older podcasts and readings.

I’ve implemented a new database system which means that previous days’ readings and podcasts that are stored locally will be lost when you upgrade (I’ll add a separate post about the technical details later).

Feel free to leave me some comments on this blog, as reviews, or via the support email.

Enjoy!

Paul.

Posted in WordLive

WordLive WP7 v1.2 published to Marketplace

I recently updated the WordLive application on MarketPlace.

The trial version is now the same as the full application (with the purchase cost reduced to £0.79/US$0.99): it isn’t possible to make this into a free app due to MarketPlace limitations.

If you like the application rather than buying it please donate to Scripture Union to help them keep producing the WordLive material. To do this using the “Donate” button in the application, or from your computer web browser.

This update also fixes an application crash with the background picture on a newly downloaded application (I wasn’t seeing it on a existing installation). The app is currently not picking up the daily pictures on the WordLive website, but I hope to be able to address this at a later date.

Posted in WordLive

Daily background images not showing on WordLive

The daily background image for the WordLive app isn’t being updated any more – as the URL of the images has moved since the beginning of the year. As a result you’ll see a black background. This is something I’m aware of and will look at fixing in a future update. It also looks like the podcast feed is also out of sync with the daily readings – I’ve posted a query about this on the WordLive forum: hopefully this is just a temporary glitch for this week.

Paul.

Posted in WordLive

WordLive for WP7 now available on the Marketplace

If you’ve got Zune or a Windows Phone 7 device, you can search for “WordLive” in the Marketplace application, or follow this link on your PC or Windows Phone 7 device:

http://social.zune.net/redirect?type=phoneApp&id=58d689a3-c5ed-df11-9264-00237de2db9e

Otherwise the easiest way of finding out more is by checking out the entry on MarketplaceBrowser…

http://www.marketplacebrowser.com/82538/wordlive

 

Posted in WordLive

WordLive for Windows Phone 7 features

The WordLive app has the following features:

  1. Access the WordLive studies (in the same form as in the public RSS feed, which is a bit different to the website version).
  2. Access the WordLive podcasts from within the WordLive application, without the need to sync using Zune from your desktop PC.
  3. View studies from previous days (if you have already downloaded them on the day they were published).
  4. Listen to podcasts from previous or future days as made available in the podcast feed.
  5. Listen to podcasts even after your phone has “locked” (gone into power saving mode)
Posted in WordLive