johnvisiomvp

Life with Visio and other Microsoft Toys!

Archive for the ‘XLF’ Category

Multilingual Toolkit does not work?

with one comment

After looking at my download stats last week, I decided to upgrade all my WP7 apps to WP8 and continue developing from the there. The stats should that it was no longer worth the effort of maintaining a WP7 version of the code. The existing programs would remain in the marketplace, but not be updated.

For most of my apps, the upgrade went fine, but one app seemed to have an issue with being multilingual. (If I was going to upgrade my apps, I might as well give the users a bit more than a WP8 version of what they had.) Unlike a new WP8 app, upgrading to multilingual was not an easy task. A Resource directory had to be added and several strategic pieces of code had to be added to handle the resource files. For some reason I had missed something in upgrading this one app. No matter what language you set the phone to, the app was in English.

So, I abandoned trying to tweak the app to get it to work and just created a new WP8 app. Turning on the Multilingual Toolkit, adding a few target languages was all that was needed to create a generic multilingual phone app. Then came the task of actually making the app useful.

  • All the files for the other pages of the original app and any extra files were copied to the directory of the new project.
  • All the extra references including the Phone Toolkit from were added.
  • The extra code from the original App.xaml and Mainpage.xaml were added to the project.
  • The records from the original AppResources.resx were copied to the new AppResources.resx
  • The project was compiled
  • The XLF files were selected and the translations were machine generated
  • One more compile

And it worked. Still not sure what exactly was wrong with the upgraded file, but I did notice that the new App.XAML did contain some resource handling code that was not in the upgraded version. Adding the missing code did not help, but it did indicate that there was something else missing.

So yes, I could have spent more time tracking down what was wrong, but it did show that starting with a clean program was a better choice. I would never know if there was something waiting to bite me.

In WP8, the process of adding multiple languages is simple

  • Install the Multilingual Toolkit
  • Turn it on
  • Populate AppResources with your phrases.
  • Find all the reference for Text= and Content=
  • Change the fixed text to use
    Text=”{Binding Path=LocalizedResources.thestring, Source={StaticResource LocalizedStrings}}” in the XAML and AppResources.thestring in the C# code
  • Compile
  • Select the languages
  • Select all the XLF files and generate a machine translation. You can improve the translations later.
  • Compile

You will now have a multilingual app.

Enjoy.

John…

John Marshall… Visio MVP       Visio.MVPs.org

Advertisements

Written by johnvisiomvp

March 19, 2014 at 12:52 pm

Visual Studio and the Multilingual Toolkit

leave a comment »

This August while taking a river cruise through Europe I created a multilingual phrase book. It worked great, but the way the multilingual toolkit worked with Visual Studio was a pain. Once you added words and phrases to the default language AppResource file, you had to launch the multilingual toolkit translation app to do the translation. Though it could be selected within Visual Studio, it ran as a standalone app and after performing the functions, the app had to be closed. This had to be repeated for each language you used. Any guesses hoe much fun doing 45 languages was?

It appears that the Visual Studio 2013 developers quietly brought the translation within Visual Studio, so now you just have to right click the xlf file and the translation is done without leaving Visual Studio. Far easier than launching many versions of the translation app and then closing them.

In Visual Studio, you have been able to select multiple files for a while, so… what if you right clicked on a bunch of xlf files? A new dialog opens with a progres bar for each XLF separated and a green check mark when done.

Like the XAML files with a C# file behind, the XLF files have a RESX file behind them. So you need those files to be hidden before you right click so that only the XLF files are selected.
XLF files
If you include a resx file in your selection you will not get the translation option. You can use the ctrl key to select the non contiguous XLF files like the sv.xlf file in this example.

As to the 45 language translations, I finally figured out that it was just a list of strings and I did not need to handle the information as a language file. That opened up the possibility of quite a few languages. All that was required was that the character set was supported on the Windows phone and I had a way of getting the strings translated. So, now it is a huge Excel spreadsheet with macros to go off and populate any new entries. When it is time to publish a new version, it is just a matter of copying a XML file to Visual Studio.

Sorry Bing, Google supports more languages.

It turns out that version 2.2 was released in Feb 2014.  There is more information here:

http://blogs.msdn.com/b/matdev/archive/2014/02/07/multilingual-app-toolkit-v2-2-released.aspx

 

Enjoy.

John…

John Marshall… Visio MVP       Visio.MVPs.org

Written by johnvisiomvp

March 16, 2014 at 2:01 pm