Udostępnij za pośrednictwem


Getting the most out of MAT’s Microsoft Translator provider

Recently I was contacted via https://aka.ms/matvoice by a developer using MAT with a question.  “Why are the results from the Microsoft Translator Provider in MAT different than those from https://www.bing.com/translator?  Well, that is a great question.  Let me answer the question by showing some of the configuration options available for that provider.

The quick answer: 

The release of MAT v3.0 added support for Microsoft Translator’s Hub (See: https://blogs.msdn.com/b/matdev/archive/2014/04/14/announcing-multilingual-app-toolkit-v3-0.aspx for specifics).  MAT uses the ‘Tech’ category by default as this is geared more towards software terms.  The Translator website uses the ‘General’ category when processing the requests.  The good news is that this is configurable if the Tech category does not fit your needs. 

Here is how to configure MAT to match that of the Translator website.
  1. Open Notepad as Administrator
  2. Open MAT’s Microsoft Translator configuration file . It is located at "C:\ProgramData\Multilingual App Toolkit\MicrosoftTranslatorProvider\TranslatorSettings.xml"
  3. Change "<Category>Tech</Category>" to "<Category>General</Category>"
  4. Save the file

Note:
Please adjust the above path If your %ProgramData% environment is different.
Be sure to restart the Editor (or VS) to use the updated configuration.

Since we are here, let’s discuss some of the other options as well…

Here is a snippet of the file:
<Provider>
  <ID>B7F979A8-D491-451C-84E8-F0C49BE620E3</ID>
  <Category>Tech</Category>
  <Protocol>HTTP</Protocol>
  <Languages>
    <Language>ar</Language>
    <Language>ar-ae</Language>
    <Language>ar-bh</Language>
    <Language>ar-dz</Language>
    …
  </Languages>
</Provider >

<Category> element

As indicated above, the <Category> element is used to add Microsoft Translator’s Hub functionality into MAT’s translation services.  However, this is not limited to the General and Tech categories.  If you have a custom Hub (or your friend does), you can set the <Category> value to their Hub and take advantage of their customized translations directly within MAT.

<Protocol> element

Looking at the configuration file, you probably noticed the <Protocol> element.  The Microsoft Translator APIs allow for translation requests using HTTPS.  By default, this is set to HTTP – as indicated by the <Protocol> value.  Changing this to HTTPS will access the Microsoft Translator Service over the SSL protocol.

<Language> elements

When you look at the <language> elements, you might be asking yourself “Why we define all the region languages separately”?  The answer is that the Microsoft Translator service uses a language neutral approach to generating translations.  An example is French France which is slightly different than French Canadian, but most of the words or phrases are common between both.  As such, to enable the supported languages and indicators, we map the Microsoft Translator neutral languages (FR) to the language specific codes (fr-FR, fr-CA, etc.)  This allows us (and you) to fine tune the support to ensure the alignment is as you desire.

image

As you can tell, the configuration file is pretty straightforward.  I hope this helps you understand some of the options that you have when using MAT and the Microsoft Translator Provider. 

Thank you,
The Multilingual App Toolkit team
multilingual@microsoft.com
User voice site: https://aka.ms/matvoice

Comments

  • Anonymous
    October 26, 2014
    Very useful post: I just added "ru", "hu" and "tr" next to the "ru-RU" entries in that file to get translations for these languages (without the culture).