支援的文件格式#

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 PO (Portable Object)

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 檔

mono

yes

yes

no

no

no

gotext JSON 檔

mono

yes

yes

no

yes

no

ARB File

mono

yes

yes

no

no

no

WebExtension JSON

mono

yes

yes

no

no

no

.NET resource files (RESX, RESW)

mono

no

yes

no

no

yes

ResourceDictionary 檔案

mono

no

no

no

no

yes

CSV 檔案

both

no

yes

yes

yes

no

需要編輯

YAML files

mono

no

no

no

no

no

Ruby YAML 檔案

mono

yes

no

no

no

no

DTD 檔案

mono

no

no

no

no

no

Flat XML files

mono

no

no

no

no

yes

Windows RC 檔案

mono

no

yes

no

no

no

Excel 開啟 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

Markdown 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 格式

mono

yes

no

no

no

no

流暢的格式

mono

no [11]

yes

no

no

no

雙語和單語格式#

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

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

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

String states#

Many file formats only differentiate 「Untranslated」 and 「Translated」 strings. With some formats it is possible to store more fine-grained state information, such as 「Needs editing」 or 「Approved」.

來源字串描述#

Source string descriptions can be used to pass additional info about the string to translate.

Several formats have native support for providing additional info to translators (for example XLIFF, GNU gettext PO (Portable Object), WebExtension JSON, CSV 檔案, Excel 開啟 XML, Qt Linguist .ts, go-i18n JSON 檔, gotext JSON 檔, ARB File, .NET resource files (RESX, RESW)). Many other formats extract closest comment as source string description.

解釋#

The 解釋 on strings can be stored and parsed from a few file formats.

Currently supported only in TermBase eXchange format.

來源字串位置#

來源碼中字串的位置會幫助熟練的譯者識別出字串如何使用。

This information is typically available in bilingual formats where strings are extracted from the source code using tools. For example GNU gettext PO (Portable Object) and Qt Linguist .ts.

翻譯旗標#

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 PO (Portable Object).

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 指定翻譯旗標.

情境#

Context is used to differentiate identical strings in a bilingual format used in different scopes (for example Sun can be used as an abbreviated name of the day 「Sunday」 or as the name of our closest star).

For monolingual formats the string identifier (often called key) can serve the same purpose and additional context is not necessary.

Pluralized strings#

將帶有不同數量的字串正確在地化時複數是必要的。規則取決於一個目標語言並且許多格式遵循 CLDR 規範。

提示

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

唯讀字串#

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

Supporting other formats#

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

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