HTML 文件

Added in version 4.1.

从 HTML 文件中提取可翻译内容并提供翻译。

备注

和其他多数格式不同,翻译文件的更改不会被导入到 Weblate,因为无法可靠地完成这一任务。翻译真实性源自 Weblate 而不是已翻译的文件。

参见

HTML

示例文件:

<html>
  <body>
    <p>Ahoj světe!</p>

    <p>Orangutan has five bananas.</p>

    <p>
      Try Weblate at <a href="https://demo.weblate.org/">weblate.org</a>!
    </p>

    <p>Thank you for using Weblate.</p>
  </body>
</html>

Weblate 配置

典型的 Weblate 部件配置

文件掩码

path/*.html

单语言译文模版语言文件

path/en.html

新语种的翻译模版

path/en.html

文件格式

HTML 文件

文件格式参数

html_merge_duplicates=True

Handling duplicate strings

By default, Weblate treats each occurrence of a string as a separate translation unit to provide line-based context. This can be problematic in HTML files, where moving elements changes the context and can lead to translation loss.

To consolidate identical strings into a single translation unit, enable Deduplicate identical strings in the 文件格式参数.

备注

Enabling this option disables line-based context for the merged units, ensuring that translations remain stable even if elements are moved within the document.