Localize your website with Microsoft Translator
Published Apr 22 2021 04:57 PM 8,108 Views

Web Localization and Ecommerce

Using Microsoft Azure Translator service, you can localize your website in a cost-effective way. With the advent of the internet, the world has become a much smaller place. Loads of information are stored and transmitted between cultures and countries, giving us all the ability to learn and grow from each other. Powered by advanced deep learning, Microsoft Azure Translator delivers fast and high-quality neural machine-based language translations, empowering you to break through language barriers and take advantage of all these powerful vehicles of knowledge and data transfer.

Research shows that 40% of internet users will never buy from websites in a foreign language[1]. Machine translation from Azure, supporting over 90 languages and dialects, helps you go to market faster and reach buyers in their native languages by localizing your web assets: from your marketing pages to user-generated content, and everything in-between.

Up to 95% of the online content that companies generate is available in only one language. This is because localizing websites, especially beyond the home page, is cost prohibitive outside of the top few markets. As a result, localized content seldom extends one or two clicks beyond a home page. However, with machine translation from Azure Translator Service, content that wouldn’t otherwise be localized can be, and now most of your content can reach customers and partners worldwide.


How to localize your website in a cost-effective way?

The first step is to understand the nature of your website content and classify them. It is critical as each of them needs different levels of localization. There are four types of content: a) static and dynamic, b) generated by you and posted by customer, c) sensitive like ‘Terms of Use’, d) part of UX elements.

Static content like about the organization, product or service description, user guides, terms of use, etc. can be translated once (or less frequently) offline into all required target languages.  Translation results could be cached and served from your webserver.  This could substantially reduce the cost of translation.  Machine translation models which powers Azure Translator service are regularly updated to improve quality. Hence consider refreshing the translations once a quarter if not every month.

User generated content like customer reviews, information requests, etc. are dynamic in nature, not all of them requiring translations, and to be translated on need basis only. You could plan for an UX element in the webpage which could initiate translation on need basis. Target language for translation could be identified based on user browser language. Likewise, responses to customer could be translated back into the language of original request or comment.

Sensitive content like terms of use, company policies, are recommended to do a human review post-machine translation. 

Text in UX elements of the webpage like menu, labels in forms, etc. are typically one or two words and have restricted space.  Hence recommended to do a UX testing post translation for fit and finish.  If necessitates look for alternate translation or human review.



Due to the speed and cost-effective nature that Azure Translator Service provides, you can easily test which localization option is optimal for your business and your users. For example, you may only have the budget to localize in dozens of languages and measure customer traffic in multiple markets in parallel. Using your existing web analytics, you will be able to decide where to invest in human translation in terms of markets, languages, or pages. For example, if the machine translated information passes a defined page view threshold, your system may trigger a human review of that content. In addition, you will still be able to maintain machine translation for other areas, to maintain reach.

By combining pure machine translation and paid translation resources, you can select different quality levels for the translations based on your business needs.


How to use Azure Translator service to translate static content


  • Create an Azure subscription
  • Once you have an Azure subscription, create a Translator resource in the Azure portal.
  • Once Translator resource it created, go to the resource, and select ‘Keys and Endpoint’ which is used to connect your application to the Translator service.




Translating static webpage content:

Below code sample shows how to translate an element in the webpage.  You could use it and iterate for each element in your webpage requiring translation.


import os, requests, uuid, json
subscription_key = "YOUR_SUBSCRIPTION_KEY"
endpoint = "https://api.cognitive.microsofttranslator.com"
path = '/translate'
constructed_url = endpoint + path

params = {
    'api-version': '3.0',
    'to': ['de'], # target language
    'textType': 'html' 

headers = {
    'Ocp-Apim-Subscription-Key': subscription_key,
    'Content-type': 'application/json',
    'X-ClientTraceId': str(uuid.uuid4())

# You can pass more than one object in body.
body = [{
    "text": "<p>The samples on this page use hard-coded keys and endpoints for simplicity. \
    Remember to <strong>remove the key from your code when you're done</strong>, and \
    <strong>never post it publicly</strong>. For production, consider using a secure way of \
    storing and accessing your credentials. See the Cognitive Services security article \
    for more information.</p>"

request = requests.post(constructed_url, params=params, headers=headers, json=body)
response = request.json()
print (response[0]['translations'][0]['text']) # shows how to access the translated text from response



Localization is just a fraction of the things that you can do with Translator, so don't let the learning stop here. Check out recent new Translator features, additional doc links to dive deeper, and join the Translator Ask Microsoft Anything session on 4/27.


Get started:


[1]  CSA Research – Can’t Read, Won’t Buy – B2C Analyzing Consumer Language Preferences and Behaviors in 29 Countries https://insights.csa-research.com/reportaction/305013126/Marketing

1 Comment
Version history
Last update:
‎Apr 22 2021 04:56 PM
Updated by: