你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

How to prevent translation of content with Azure AI Translator

Azure AI Translator allows you to tag content so that it isn't translated. For example, you might want to tag code, a brand name, or a word/phrase that doesn't make sense when localized.

Methods for preventing translation

  1. Tag your content with notranslate. It's by design that this works only when the input textType is set as HTML

    Example:

    <span class="notranslate">This will not be translated.</span>
    <span>This will be translated. </span>
    
    <div class="notranslate">This will not be translated.</div>
    <div>This will be translated. </div>
    
  2. Tag your content with translate="no". This tag only works when the input textType is set as HTML

    Example:

    <span translate="no">This will not be translated.</span>
    <span>This will be translated. </span>
    
    <div translate="no">This will not be translated.</div>
    <div>This will be translated. </div>
    
  3. Use the dynamic dictionary to prescribe a specific translation.

  4. Don't pass the string to the Translator for translation.

  5. Custom Translator: Use a dictionary in Custom Translator to prescribe the translation of a phrase with 100% probability.

Next steps