支持的文件格式#

Weblate supports a wide range of translation formats. Each format is slightly different and provides a different set of capabilities.

提示

為您的應用程序選擇文件格式時,最好在您使用的工具箱/平台中保留一些公認的格式。這樣,您的翻譯人員可以額外使用他們習慣使用的任何工具,並且更有可能為您的項目做出貢獻。

自動偵測#

Weblate tries to detect file format during 添加翻譯項目和組件. The detection might be wrong for different variants of the same serialization format (JSON, YAML, properties) or file encoding, so please verify that 檔案格式 is correct before creating the component.

翻譯類型功能#

所有受支持格式的功能#

Format

語言能力 [1]

複數 [2]

Descriptions [3]

語境 [4]

位置 [5]

標記 [8]

附加狀態 [6]

GNU gettext

bilingual

yes

yes

yes

yes

[9]

需要編輯

單語 gettext

mono

yes

yes

yes

yes

[9]

需要編輯

XLIFF

both

yes

yes

yes

yes

yes

需要編輯,已同意

Java 屬性

both

no

yes

no

no

no

mi18n lang files

mono

no

yes

no

no

no

GWT 屬性

mono

yes

yes

no

no

no

Joomla 翻譯

mono

no

yes

no

yes

no

Qt Linguist .ts

both

yes

yes

no

yes

yes

需要編輯

Android字串資源

mono

yes

[7]

no

no

yes

蘋果 iOS 字串

both

no

yes

no

no

no

PHP 字串

mono

[10]

yes

no

no

no

JSON files

mono

no

no

no

no

no

i18next JSON files

mono

yes

no

no

no

no

go-i18n JSON files

mono

yes

yes

no

no

no

gotext JSON files

mono

yes

yes

no

yes

no

ARB File

mono

yes

yes

no

no

no

WebExtension JSON

mono

yes

yes

no

no

no

RESX .NET resource files

mono

no

yes

no

no

yes

ResourceDictionary files

mono

no

no

no

no

yes

CSV 文件

both

no

yes

yes

yes

no

需要編輯

YAML files

mono

no

no

no

no

no

Ruby YAML files

mono

yes

no

no

no

no

DTD files

mono

no

no

no

no

no

Flat XML files

mono

no

no

no

no

yes

Windows RC files

mono

no

yes

no

no

no

Excel Open XML

mono

no

yes

yes

yes

no

需要編輯

App store 中介資料檔

mono

no

no

no

no

no

Subtitle files

mono

no

no

no

yes

no

HTML files

mono

no

no

no

no

no

OpenDocument Format

mono

no

no

no

no

no

IDML Format

mono

no

no

no

no

no

INI 翻譯

mono

no

no

no

no

no

Inno Setup INI translations

mono

no

no

no

no

no

TermBase eXchange format

bilingual

no

yes

no

no

yes

文字檔

mono

no

no

no

no

no

Stringsdict format

mono

yes

yes

no

no

no

Fluent format

mono

no [11]

yes

no

no

no

雙語和單語格式#

支持 monolingual 和 bilingual 格式。雙語格式在單個文件中存儲兩種語言 —— 源和翻譯(典型示例是 GNU gettextXLIFF蘋果 iOS 字串 字串)。另一方面,單語格式通過 ID 識別字串,每個語言文件僅包含那些語言到任何給定語言(通常是 Android字串資源)的映射。兩種變體都使用某些文件格式,請參見下面的詳細說明。

為了正確使用單語文件,Weblate 要求訪問一個包含完整字串列表的文件,以與其源一起翻譯—— 該文件在Weblate 中稱為:ref:component-template,儘管命名方式可能會有所不同。

另外,可以利用 中間語言檔案 擴展此工作流程,以包括開發人員提供的字串,但不要在最終的字串中使用。

翻譯旗標#

Translation flags allow customizing Weblate behavior. Some formats support defining those in the translation file (you can always define them in the Weblate interface, see 使用標誌自定義行為).

This feature is modelled on flags in GNU gettext.

Additionally, for all XML based format, the flags are extracted from the non-standard attribute weblate-flags. Additionally max-length:N is supported through the maxwidth attribute as defined in the XLIFF standard, see 指定翻譯標記.

Pluralized strings#

Plurals are necessary to properly localize strings with variable count. The rules depend on a target language and many formats follow CLDR specification for that.

提示

Pluralizing strings need proper support from the application framework as well. Choose native format of your platform such as GNU gettext, Android字串資源 or Stringsdict format.

唯讀字串#

在 3.10 版本新加入.

將包含來自翻譯文件的只讀字串,但不能在 Webleate 中編輯。此功能本功能僅由少量格式支持( xliff`和 :ref:`aresource),但可以通過添加一個 read-only 標記,參閱 使用標誌自定義行為

Supporting other formats#

支持序列化的大多數格式可以輕鬆支持支持序列化,但他們沒有(尚未)接收任何測試。在大多數情況下,Weberate需要一些薄層以隱藏不同`Translate-Toolkit`_ Storage的行為的差異。

要為新格式添加支持,首先要在“translate-toolkit`_中為其實現支持。