Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Localization by Build

0.00/5 (No votes)
14 Nov 2014 1  
Localization by Build

Introduction

This tip will outline how to apply localization to your application using https://www.nuget.org/packages/DevUtils.Elas.Pretranslate.MicrosoftTranslation/, this extension for https://www.nuget.org/packages/DevUtils.Elas.Core/. DevUtils ELAS Core is a Nuget package, but it does not add any additional References in any project it just embedded into the build process of the project, as well as adds to its configuration file Solution ".elas\ElasConfiguration.props".

Using the Package

Add reference to Project. Build project. After building the project (as of this writing the latest version 0.0.5 which supports .NET4.x, Windows Store, Windows Store Phone projects and Resx, Resw files), each resource file will have Xliff (Xlf) file. DevUtils ELAS for Microsoft Translation automatically translated string using Microsoft Translation (internet connection required). I currently used free subscription, it's 2`000`000 characters per month. If this limit is exceeded, you can self-register / subscribe to the data market (http://msdn.microsoft.com/en-us/library/hh454950.aspx, points 1 and 2), and add value to ElasConfiguration.props.

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
... 
    <PropertyGroup>
        <ElasMicrosoftTranslationClientId>%Ваш Client ID%</ElasMicrosoftTranslationClientId>
        <ElasMicrosoftTranslationClientSecret>%Ваш Client secret%</ElasMicrosoftTranslationClientSecret>
    </PropertyGroup>
 ... 
</Project>

After analyzing Xliff file(s) and setting the «target state» to «translated», run «Build». Localization done.

Recommendations

For comfortable work with Xliff files in Visual Studio, add the XML schema itself, it is in the packages\DevUtils.Elas.Core.xxxx\Schemas\xliff-core-1.2-transitional.xsd.
With the localization of a large resource file (the first time) that there was no situation that the Build process is "frozen", including the MSBuild project build output verbosity in Visual Studio less than Minimal, in this case, you will see the progress of the automatic translation using Microsoft Translate.

Conclusion

The project is at an early stage of development. In the future, we plan to expand the list of supported projects and sources for translation.
Thank you for reading.

History

  • 14th November, 2014: Initial version

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here