支援的文件格式¶
Weblate supports a wide range of translation formats. Each format is slightly different and provides a different set of capabilities.
提示
為您的應用程序選擇文件格式時,最好在您使用的工具箱/平台中保留一些公認的格式。這樣,您的翻譯人員可以額外使用他們習慣使用的任何工具,並且更有可能為您的項目做出貢獻。
- Android 字串資源
- 蘋果 iOS 字串
- App store 中介資料檔案
- ARB 檔案
- CSV 檔案
- DTD 檔案
- Excel Open XML
- Flat XML 檔案
- 流暢的格式
- Format.JS JSON 檔案
- GNU gettext PO (Portable Object)
- go-i18n JSON 檔
- gotext JSON 檔
- GWT 屬性
- HTML 檔案
- i18next JSON 檔案
- IDML 格式
- INI 翻譯
- Inno Setup INI 翻譯
- Java 屬性
- Joomla 翻譯
- JSON 檔案
- Laravel PHP 字串
- Markdown 檔案
- mi18n lang 檔案
- Mobile Kotlin 資源
- OpenDocument 格式
- PHP 字串
- Qt Linguist .ts
- ResourceDictionary 檔案
- .NET 資源檔案 (RESX, RESW)
- Ruby YAML 檔案
- Stringsdict 格式
- 字幕檔案
- TermBase eXchange 格式
- 文字檔
- WebExtension JSON
- Windows RC 檔案
- XLIFF
- YAML 檔案
自動偵測¶
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.
翻譯類型功能¶
格式 |
語言能力 [1] |
複數 [2] |
Descriptions [3] |
語境 [4] |
位置 [5] |
標記 [8] |
附加狀態 [6] |
---|---|---|---|---|---|---|---|
雙語 |
是 |
是 |
是 |
是 |
是 [9] |
需要編輯 |
|
mono |
是 |
是 |
是 |
是 |
是 [9] |
需要編輯 |
|
兩者 |
是 |
是 |
是 |
是 |
是 |
需要編輯,已同意 |
|
兩者 |
否 |
是 |
否 |
否 |
否 |
||
mono |
否 |
是 |
否 |
否 |
否 |
||
mono |
是 |
是 |
否 |
否 |
否 |
||
mono |
否 |
是 |
否 |
是 |
否 |
||
兩者 |
是 |
是 |
否 |
是 |
是 |
需要編輯 |
|
mono |
是 |
是 [7] |
否 |
否 |
是 |
||
兩者 |
否 |
是 |
否 |
否 |
否 |
||
mono |
否 [10] |
是 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
是 |
否 |
否 |
否 |
否 |
||
mono |
是 |
是 |
否 |
否 |
否 |
||
mono |
是 |
是 |
否 |
是 |
否 |
||
mono |
是 |
是 |
否 |
否 |
否 |
||
mono |
是 |
是 |
否 |
否 |
否 |
||
mono |
否 |
是 |
否 |
否 |
是 |
||
mono |
否 |
否 |
否 |
否 |
是 |
||
兩者 |
否 |
是 |
是 |
是 |
否 |
需要編輯 |
|
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
是 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
是 |
||
mono |
否 |
是 |
否 |
否 |
否 |
||
mono |
否 |
是 |
是 |
是 |
否 |
需要編輯 |
|
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
是 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
雙語 |
否 |
是 |
否 |
否 |
是 |
||
mono |
否 |
否 |
否 |
否 |
否 |
||
mono |
是 |
否 |
否 |
否 |
否 |
||
mono |
no [11] |
是 |
否 |
否 |
否 |
雙語和單語格式¶
支援 monolingual 和 bilingual 格式。雙語格式在單個文件中儲存兩種語言 —— 源和翻譯(典型示例是 GNU gettext PO (Portable Object),XLIFF 或 蘋果 iOS 字串 字串)。另一方面,單語格式通過 ID 識別字串,每個語言文件僅包含那些語言到任何給定語言(通常是 Android 字串資源)的映射。兩種變體都使用某些文件格式,請參見下面的詳細說明。
為了正確使用單語文件,Weblate 要求存取一個包含完整字串列表的文件,以與其源一起翻譯—— 該文件在Weblate 中稱為:ref:component-template,儘管命名方式可能會有所不同。
另外,可以利用 中間語言檔案 擴展此工作流程,以包括開發人員提供的字串,但不要在最終的字串中使用。
字串狀態¶
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 Open XML, Qt Linguist .ts, go-i18n JSON 檔, gotext JSON 檔, ARB 檔案, .NET 資源檔案 (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 格式.
來源字串位置¶
來源碼中字串的位置會幫助熟練的譯者識別出字串如何使用。
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.
複數化字串¶
將帶有不同數量的字串正確在地化時複數是必要的。規則取決於一個目標語言並且許多格式遵循 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`_中為其實現支援。