Click here to Skip to main content
15,886,689 members
Articles / Programming Languages / C# 4.0
Tip/Trick

Localization by "Build"

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
14 Nov 2014CPOL1 min read 10.3K   2  
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
<?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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Congree Language Technologies GmbH
Russian Federation Russian Federation
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --