Managing multiple languages is always a challenge in app development, and it can be difficult when you don’t have a team of translators to help localize a project. Fortunately, Microsoft provides some tools that make the process easier, and even give you some ability to automatically translate your resources into other languages. The Multilingual App Toolkit automates the process of language support for you, and even provides free translations to other languages. It works with many platforms, including WPF, UWP, and Xamarin. In this article, we’ll cover setting up the Multilingual App Toolkit on your machine and using it with a project.
First steps to using the Multilingual App Toolkit
First, you’ll want to download .msi from website and install it to your machine:
Next, if you’re using VS 2017, you’ll also need to install an extension:
The Multilingual App Toolkit works with both the Microsoft Language Portal (and the Microsoft Terminology Service API) as well as the Microsoft Translator services (which requires an Azure account with a Cognitive Services Subscription). We’ll focus on using the Microsoft Language Portal integration since it’s a free service, but you can also opt into the Translator services as well.
Add the Multilingual App Toolkit to your project
First, make sure you have a neutral language set for your project. This can be set on the Project properties page under the Package Tab:
Next, select your project. In the Tools menu, select Multilingual App Toolkit -> Enable Selection.
Now you should be able to add new translation languages to your project. To do so, right-click on your Resources, and choose MultiLanguage Toolkit -> Add Translation Language:
This opens another window with a list of languages:
Languages are marked with an orange magnifying glass can be translated for free through the Microsoft Language portal.
After you select a language, the toolkit adds a corresponding resx file for that language and an .xlf file under the MultiLanguageResources folder.
Translate files with Multilingual App Toolkit
To translate these files, open an .xlf file with the MultiLingual Editor (which was installed as part of the .msi earlier). You’ll need to right-click the file, choose Open With, and manually add the editor to the list of options. It should install into Program Files(x86).
Once the Editor opens, you should see something like this:
Click Translate All to try to localize all of the strings in the file. Once this is complete, you can review the output and make any desired changes. Clicking Save updates the .xlf file, and an updated rex file will be generated on the next build. Make sure the .xlf file has the Build Actoin XLIFF Localization file marked so that actually translates on the next build:
That’s it! At this point, you can rebuild your project and have the resx file for the language that you’ve added populate.
Final Thoughts on the Multilingual App Toolkit
The Multilingual App Toolkit provides a lot of functionality for a free service. It works quite well with single word translations, though it can run into problems with longer phrases and sentences. Using the Microsoft Translator services through Azure likely improves this, but my experience with it has been limited.
If you’re curious for more information about the process (or using the tool with Xamarin.Forms specifically), there is an interesting blog and video on Xamarin’s site that’s worth checking out. It’s a great tool worth checking out.