如何使用翻译器防止翻译内容

使用翻译器可以标记内容,以便不对其进行翻译。 例如,你可能想要标记本地化后没有意义的代码、品牌名称或单词/短语。

阻止翻译的方法

  1. 使用 notranslate 标记内容。 根据设计,仅当输入 textType 设置为 HTML 时,这才起作用

    示例:

    <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" 标记内容。 这仅适用于以 HTML 形式设置输入 textType 的情况

    示例:

    <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. 使用动态词典给出特定翻译。

  4. 不要将字符串传递到翻译器进行翻译。

后续步骤