Partilhar via


MAT v4.0 Technical Preview adds Xamarin support

The Multilingual App Toolkit v4.0 Technical Preview adds support for VS + Xamarin based iOS and Android projects.  We are super excited (just had to say it) about adding MAT’s localization workflow for developers using Visual Studio and Xamarin to create great cross-platform apps! You can download it here

image

I am fortunate enough to be in attendance at Xamarin Evolve 2014 this week. On Monday I attended a training session presented by Craig Dunn on Xamarin localization.  Craig did a great job covering localization in general, then focused on iOS and Android projects specifics as well as RESX with Xamarin Forms.  Craig’s demo code is available on GitHub.  So of course I wanted to see how the v4.0 technical preview would handle the code.  The demo is pre-populated with the target RESX files, so I simply removed them before using MAT v4.0 preview to add Japanese (JA) and Arabic (AR).  After generating translating using the default translation providers.  As you can tell from the images below everything worked as expected.

image  image  image  image

The product still works the same - just add languages and let MAT manage the target resources and translation services, etc.  In fact if you never used MAT before but watched some of the videos (https://aka.ms/matphone or https://aka.ms/matcodechat), you might not even notice anything different in the basic workflow.

To enable Xamarin Support we have made some key changes – including some breaking ones.  We believe these changes will improve the experience for all project types and this was the right time to implement the changes.  The changes are based on user feedback as well as some technical design improvements to make management of projects easier and less intrusive to build systems.

As a result, v4.0 is not compatible with previous version.  The addition of an upgrade feature will be available in a future build but is not included in this release.  To ensure the technical preview is not accidently installed and run against v3.x projects we have added some blocks to safeguard production machines and projects. 

One such safeguard is to block setup on machines with previous versions of MAT still installed.  Once MAT v4.0 Technical Preview is installed, projects that were enabled with v3.x will fail to open to help protect the 3.x based projects.  As you can see from the message, we have documented how to manually apply an upgrade if you want to test existing projects.  Running in production environments is not recommend and it is strongly recommend that backup your projects before attempting any manual upgrades.   Please see https://aka.ms/matpreview for the download information, latest FAQ and articles, including the manual upgrade article.

image

Since this is a Technical Preview, it will have areas that are unfinished, just don't work as expected, and in a few cases - like 3.1 to 4.0 updates - just don’t exist.  However, your input is important and we wanted to get this preview in your hands early so we could make changes as needed.

For those you use that use MAT daily, here is the short list of changes that will be the most interesting:

Pseudo language is not automatically added when the project is enabled.
The first thing that you will notice is that Pseudo XLF file is not automatically added.  The side effect is that your project will not have any noticeable changes when enabled.   However, if you right click the project (or solution), you will see the familiar ‘Add Translation Languages’ menu.  All the languages are still available, including Pseudo, but the supported language sets vary between the different platforms.  Be sure to check each platform’s language support. Adding an unsupported language can case a build break. If this happens, simply removing the language from the specific platform will get you going again.

Restructuring of the XLIFF project management to be consistent for every project
If you’ve created a Windows Store, Phone or Desktop apps using MAT, you know that some projects use the MultilingualResources folder and others do not.  Going forward, all projects will use the MultilingualResources folder to store the project’s based XLF files.  This will provide a consistent location for projects, including the newly supported VS + Xamarin based projects.

Restructuring of the XLIFF file’s contents
Prior to the preview, MAT would create a separate XLF files for each resource file in a RESX based project, but a single XLF file for PRI based projects regardless of the number of native source resource files.  If your RESX based project only contained one resource file like mine do, this change is not as noticeable.  However, if you use multiple RESX files, you will notice the difference right away.  XLIFF supports multiple <file> elements, but we did not have a strong need of this capability.  Storing all the resources in a single XLF file has change this.  Now, each native source file (AppResources.resx and ErrorResources.resx) are store in the XLF file with unique file nodes.

No longer dependent on platform specific build integration
Build integration have been a challenge with every release.  This is evident by looking at some of the workaround blogs that we have posted.  Not being dependent on platform specific build integration lets the native compilers do all the work without MAT getting in the way.  It also allows MAT to not break when in Xamarin Studio’s IDE.  Being outside of Visual Studio, you don't get the benefit of MAT’s workflow, but you will still get multilingual builds and that’s pretty cool!

Recursive and multi-select project management
We have enabled MAT’s menus to work recursively from the selected node (or nodes).  So, if you Enable while the solution is selected, all supported projects will be enabled.  This also works for other menus like Generate Machine Translations, etc. 

Reading and Writing of Native resource formats
With the Technical preview, the workflow reads the native source resource files to populate the XLF file and then creates the native target resource files.  Windows Phones and Desktop apps are familiar with this models, but this is a big change for Windows Store apps as MAT never created the native resw or resjson files until now.  This will help with understanding the result for the target files as well as no longer calling platform specific build integrations.

Download the Technical Preview
We created a landing page at https://aka.ms/matpreview that contains links to the install point as well as the feedback and articles.  The technical preview is hosted via Visual Studio Gallery so you will automatically get update notifications one it is installed.

If you are at Xamarin Evolve 2014, be sure to look me up.

Cameron
@CameronLerum
multilingual@microsoft.com
User voice site: https://aka.ms/matvoice

Comments

  • Anonymous
    October 07, 2014
    Have you considered writing an AddIn for XS to integrate the workflow?

  • Anonymous
    October 07, 2014
    @Marius Currently we support the workflow in Visual Studio only.  However, The projects continue to build in Xamarin Studio since we generate the native resource files.  Full XS integration is undecided at this time.

  • Anonymous
    October 08, 2014
    Thats great news. I particularly like that you are standardising the different projects types and using build in build process. This should really come as standard with Visual Studio.

  • Anonymous
    October 29, 2014
    This sounds great! One question though: Will v4 address the issue of unneccessary builds? V3 will rebuild my app project every time, even if not a single file has changed. This is especially annoying during debugging: Each time I restart debugging, my project will be rebuilt, instead of just launching the last build. Worst is when I have .NET Native enabled, where each build takes ~2 minutes. Guess how much time I already lost due to Multilingual App Toolkit... You should check the dates of the resource files, and only perform a build if one of the files has changed!

  • Anonymous
    October 29, 2014
    Lukas - Yes, incremental builds are part of the release plan, and yes it is annoying without it.  :-(

  • Anonymous
    November 14, 2014
    Nice Article...stranger! :)

  • Anonymous
    November 14, 2014
    Thanks!  Give it a try and let's do lunch.  :-)

  • Anonymous
    November 14, 2014
    MAT doesn't work on a Mac! ;)

  • Anonymous
    November 20, 2014
    Nice Article....to localize android and IOS resource files in native format (.xml & .strings respectively) we need to do development work in VS which is one of the constraint. Is there any constraint like resource file format or anything else :)

  • Anonymous
    December 03, 2014
    @Mudit, Xamarin supports iOS and Android using their native resource formats.  MAT workings with these native formats with using in conjunction with Visual Studio + Xamarin. Thanks, Cameron