johnvisiomvp

Life with Visio and other Microsoft Toys!

Universal Apps – Multilingual Toolkit

leave a comment »

I fell in love with the Multilingual Toolkit when it was first introduced and found it very useful to add multiple languages to my apps. The only down side was that the submission process increased with each language. Even so, the Toolkit was useful in translating the text that is submitted with the app. All I had to do was add extra strings to the project, have them translations and then use the translations in the submission.

The XLF files use an industry standard for translators, so it is a very useful way to communicate with translators. The translator may have his own application for handling the XLF file, but the Toolkit does come with a useful app that anyone can use to do the translation. Unfortunately, the first release seemed to indicate that you had to install Visual Studio, the current version still seems to be a part of Visual Studio.

Of course, that familiarity caused problems. When you add languages in WP7 or WP8, the toolkit would automatically add the resource file (resx) and the XLF file for that language. With 8.1, only the XLF file is added. Of course, correcting that mistake is a mistake, only the resource file for the default language is needed. If you add the missing resource files, you will get a cryptic error message about duplication.

Rather than AppResources.resx, 8.1 uses resw files and the name is string/EN/Resources.resw. Converting from resx to resw is just a matter of renaming the extension, but I prefer to just copy all the strings and paste. I have yet to try it, but it should be possible to add the language to the filename as was done in WP7 / WP8.

With 8.1 the C# code for using strings from the resource file is to add

var loader = new Windows.ApplicationModel.Resources.ResourceLoader();

and
ErrorBlock.Text = loader.GetString(“ErrorCode01”)

In the xaml it is a matter of

x:Uid="Help"

to the textblock or button. This will overwrite the content of the Text or Content parameter, but they should be left in for editing. I tend to add an x to the end of the test. Unlike in WP7 and WP8, Visual Studio does not show the resource string in the editor. So the overwritten string are useful for determining the look and feel while editing.

Also  there is no XML that shows the languages being used, so the task of removing a language is just a matter of deleting the appropriate XLF file.

Another interesting thing is that the UIC can change several attributes. So for one use of a UIC, you can change the text and the width for a textblock. In the resource file it would be Help.Text and Help.Width.

Enjoy.

John Marshall… Visio MVP       Visio.MVPs.org

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: