如何使用翻译器防止翻译内容How to prevent translation of content with the Translator

使用翻译器可以标记内容,以便不对其进行翻译。The Translator allows you to tag content so that it isn't translated. 例如,你可能想要标记本地化后没有意义的代码、品牌名称或单词/短语。For example, you may want to tag code, a brand name, or a word/phrase that doesn't make sense when localized.

阻止翻译的方法Methods for preventing translation

  1. 使用 notranslate 标记内容。Tag your content with notranslate. 根据设计,仅当输入 textType 设置为 HTML 时,这才起作用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. 使用 translate="no" 标记内容。Tag your content with translate="no". 这仅适用于以 HTML 形式设置输入 textType 的情况This 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.

Next steps