支持的文件格式

Weblate 支持 translate-toolkit 理解的大多數翻譯格式,但是每種格式都略有不同,可能會出現未經良好測試的格式問題。

備註

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

雙語和單語格式

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

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

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

自動偵測

Weblate 可以自動檢測幾種常用的文件格式,但是這種檢測會損害您的性能,並且會限制特定於給定文件格式的功能(例如,自動添加新翻譯)。

翻譯類型功能

所有受支持格式的功能:

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

10

需要編輯,已同意

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

10

需要編輯

安卓字符串資源

mono

yes

7

no

no

10

蘋果 iOS 字符串

both

no

yes

no

no

no

PHP 字串

mono

11

yes

no

no

no

JSON files

mono

no

no

no

no

no

JSON i18next files

mono

yes

no

no

no

no

go-i18n JSON files

mono

yes

no

no

no

no

ARB File

mono

yes

yes

no

no

no

WebExtension JSON

mono

yes

yes

no

no

no

.XML resource files

mono

no

yes

no

no

10

ResourceDictionary files

mono

no

no

no

no

10

CSV 文件

both

no

yes

yes

yes

no

需要編輯

YAML files

mono

no

yes

no

no

no

Ruby YAML files

mono

yes

yes

no

no

no

DTD files

mono

no

no

no

no

no

Flat XML files

mono

no

no

no

no

10

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

10

文字檔

mono

no

no

no

no

no

Stringsdict format

mono

yes

yes

no

no

no

Fluent format

mono

no 12

yes

no

no

no

1

請參見 雙語和單語格式

2

將帶有不同數量的字符串正確本地化時復數是必要的。

3

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

4

文本用於卻別不同範圍中使用的相同字符串(例如`Sun`可以用作 「Sunday」 名稱的縮寫,或用作我們最近的恆星)。

5

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

6

Additional states supported by the file format in addition to 「Untranslated」 and 「Translated」.

7

XML comment placed before the <string> element, parsed as a source string description.

8

請參見 Customizing behavior using flags

9(1,2)

gettext 類型的註釋用作標記。

10(1,2,3,4,5,6,7)

對於基於格式所有 XML,標記從非標準的屬性 weblate-flags 中提取。此外,max-length:N 通過``maxwidth`` attribute <http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#maxwidth>`_如在XLIFF 標準中定義的,請參見:ref:`xliff-flags

11

只對於 Laravel 來支持複數,在字符串語法中使用來定義它們,請參見 Localization in Laravel

12

Plurals are handled in the syntax of the strings and not exposed as plurals in Weblate.

唯讀字串

在 3.10 版本新加入.

將包含來自翻譯文件的只讀字符串,但不能在Webleate中編輯。此功能本功能僅由少量格式支持(:REF:xliff`和:ref:`aresource),但可以通過添加一個`````````。

GNU gettext

Most widely used format for translating libre software.

通過調整文件頭或鏈接到相應的源文件,可以支持存儲在文件中的語境信息。

雙語 gettext PO 文件通常如下所示:

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "Monday"
msgstr "Pondělí"

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "Tuesday"
msgstr "Úterý"

#: weblate/accounts/avatar.py:163
msgctxt "No known user"
msgid "None"
msgstr "Žádný"

典型的 Weblate 組件配置

文件掩碼

po/*.po

單語的基底語言檔

Empty

新翻譯的模板

po/messages.pot

檔案格式

Gettext PO file

也參考

:doc:devel / getText,:doc:devel / sphinx`,wikipedia上的getext <https://en.wikipedia.org/wiki/gettext>`_,:ref:addon-webblate.gettext.configure,:ref:addon-webblate.gettext.customize,:ref:addon-weblate.gettext.linguas`Mo:ref:ref:addon-weblate.gettext.msgmerge

單語 gettext

一些項目決定使用 gettext 作為單語格式 —— 它們僅在源代碼中編碼 ID,然後將字符串翻譯成所有語言,包括英語。支持此功能,儘管在將組件導入 Weblate 時必須明確選擇此文件格式。

單語言的 gettext PO 文件通常如下所示:

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-monday"
msgstr "Pondělí"

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-tuesday"
msgstr "Úterý"

#: weblate/accounts/avatar.py:163
msgid "none-user"
msgstr "Žádný"

基本語言文件將是:

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-monday"
msgstr "Monday"

#: weblate/media/js/bootstrap-datepicker.js:1421
msgid "day-tuesday"
msgstr "Tuesday"

#: weblate/accounts/avatar.py:163
msgid "none-user"
msgstr "None"

典型的 Weblate 組件配置

文件掩碼

po/*.po

單語的基底語言檔

po/en.po

新翻譯的模板

po/messages.pot

檔案格式

Gettext PO 文件(單語)

XLIFF

創建基於 XML 的格式來標準化翻譯文件,但最終它是該領域中 許多標準 之一。

XML Localization Interchange File Format (XLIFF) 通常用作雙語言格式,但 Weblate 也支持其作為單語言格式。

Weblate supports XLIFF in several variants:

XLIFF translation file

Simple XLIFF file where content of the elements is stored as plain text (all XML elements being escaped).

XLIFF with placeables support

Standard XLIFF supporting placeables and other XML elements.

XLIFF with gettext extensions

XLIFF enriched by XLIFF 1.2 Representation Guide for Gettext PO to support plurals.

翻譯狀態

在 3.3 版本變更: 3.3 版本前的 Weblate 忽略 state 屬性。

文件中的``state`` 屬性在Weblate 中被部分處理並映射為」Needs edit」 (需要編輯)的狀態(如果出現目標的話,後面的狀態用於將字符串標記為需要編輯: new `` ``needs-translationneeds-adaptationneeds-l10n )。如果應該省略 state 屬性,只要 <target> 元素存在,那麼字符串被認為需要翻譯。

如果翻譯字符串具有``approved=」yes」``,那麼它還將被導入Weblate 作為」Approved」(同意的),任何其它內容被導入作為」Waiting for review」 (等待复核,這與XLIFF 規範匹配)。

當存儲時,Weblate 如無必要不會添加其它屬性:

  • state 屬性只在字符串標記為需要編輯的情況下添加。

  • approved 屬性只在字符串已經被複查的情況下添加。

  • 在其它情況下不添加屬性,但在它們出現的情況下更新。

那意味著當使用 XLIFF 格式時,強烈推薦打開 Weblate 複查過程,從而能看到並更改字符串的同意狀態。

相似地在導入這樣的文件時(在上傳表格中),應該選擇 Processing of strings needing edit 之下的 Import as translated

也參考

專門的審核者

XLIFF 中的空白字符和新行符

在 XML 格式中不區分通常類型或量的空白字符。如果想要保留,必須將 xml:space="preserve" 標記添加到字符串中。

例如:

    <trans-unit id="10" approved="yes">
        <source xml:space="preserve">hello</source>
        <target xml:space="preserve">Hello, world!
</target>
    </trans-unit>

指定翻譯標記

還可以通過使用 weblate-flags 屬性指定附加的翻譯標記(請參見 Customizing behavior using flags)。 Weblate 還理解來自 XLIFF 規範的 maxwidthfont 屬性:

<trans-unit id="10" maxwidth="100" size-unit="pixel" font="ubuntu;22;bold">
   <source>Hello %s</source>
</trans-unit>
<trans-unit id="20" maxwidth="100" size-unit="char" weblate-flags="c-format">
   <source>Hello %s</source>
</trans-unit>

解析 font 屬性用於字體集、尺寸和粗細,上面的示例顯示了全部,儘管只需要字符集。字符集中的任何空白字符被轉換為下劃線,所以 Source Sans Pro 變成 Source_Sans_Pro ,當命名字符集時請記住這些請參見 管理字型)。

String keys

Weblate 通過 resname 屬性在它出線的情況下識別 XLIFF 文件中的單元,並退回到 id (如果出現的話與 file 標籤一起)。

resname 屬性被認為是人類友好的單元識別符,對 Weblate 比 id 更適於顯示。在整個 XLIFF 文件中 resname 具有一致性。這是 Weblate 需要的,並且不被 XLIFF 標準覆蓋——它不在這個屬性上放入任何獨特性限制。

用於雙語言 XLIFF 的典型 Weblate 組件配置

文件掩碼

localizations/*.xliff

單語的基底語言檔

Empty

新翻譯的模板

localizations/en-US.xliff

檔案格式

XLIFF 翻譯文件

用於單語言 XLIFF 的典型 Weblate 組件配置

文件掩碼

localizations/*.xliff

單語的基底語言檔

localizations/en-US.xliff

新翻譯的模板

localizations/en-US.xliff

檔案格式

XLIFF 翻譯文件

也參考

`xliff在wikipedia上<https://en.wikipedia.org/wiki/xliff>`_ ,: doc:tt:格式/ xliff,xliff中的`font屬性1.2 <http://docs.oasis-open。org / xliff / v1.2 / os / xliff-core.html#font>`_,maxwidth屬性在xliff 1.2

Java 屬性

用於翻譯的本地 Java 格式。

Java 屬性通常用作單語言翻譯。

Weblate 支持這個格式的 ISO-8859-1、UTF-8 和 UTF-16 變體。它們所有都支持存儲 Unicode 字符,只是編碼不同。在 ISO-8859-1 中,使用了 Unicode 轉義序列(例如 zkou\u0161ka),所有其它編碼字符直接或者在 UTF-8 中或者在 UTF-16 中。

備註

加載轉義序列也在 UTF-8 模式中工作,因此請小心選擇正確的編碼組,與您應用的需要匹配。

典型的 Weblate 組件配置

文件掩碼

src/app/Bundle_*.properties

單語的基底語言檔

src/app/Bundle.properties

新翻譯的模板

Empty

檔案格式

Java Properties (ISO-8859-1)

mi18n lang files

在 4.7 版本新加入.

File format used for JavaScript localization by mi18n. Syntactically it matches Java 屬性.

典型的 Weblate 組件配置

文件掩碼

*.lang

單語的基底語言檔

en-US.lang

新翻譯的模板

Empty

檔案格式

mi18n lang file

GWT 屬性

用於翻譯的本地 GWT 格式。

GWT 屬性通常用作單語言翻譯。

典型的 Weblate 組件配置

文件掩碼

src/app/Bundle_*.properties

單語的基底語言檔

src/app/Bundle.properties

新翻譯的模板

Empty

檔案格式

GWT 屬性

INI 翻譯

在 4.1 版本新加入.

用於翻譯的 INI 文件格式。

INI 翻譯通常用作單語言翻譯。

典型的 Weblate 組件配置

文件掩碼

language/*.ini

單語的基底語言檔

language/en.ini

新翻譯的模板

Empty

檔案格式

INI File

備註

Weblate 只從 INI 文件內的章節中提取鍵。在您的 INI 文件缺乏章節的情況下,會想要替代使用 Joomla 翻譯Java 屬性

Inno Setup INI translations

在 4.1 版本新加入.

Inno Setup INI file format for translations.

Inno Setup INI translations are usually used as monolingual translations.

備註

唯一需要注意的差異是 INI 翻譯 支持 %n%t 佔位符用於換行和製表符。

典型的 Weblate 組件配置

文件掩碼

language/*.islu

單語的基底語言檔

language/en.islu

新翻譯的模板

Empty

檔案格式

Inno Setup INI File

備註

當前只支持 Unicode 文件(.islu),當前不支持 ANSI 變體(.isl)。

Joomla 翻譯

在 2.12 版本新加入.

用於翻譯的本地 Joomla 格式。

Joomla 翻譯通常用作單語言翻譯。

典型的 Weblate 組件配置

文件掩碼

language/*/com_foobar.ini

單語的基底語言檔

language/en-GB/com_foobar.ini

新翻譯的模板

Empty

檔案格式

Joomla 語言文件

Qt Linguist .ts

基於 Qt  的應用中使用的翻譯格式。

Qt Linguist 文件既用作雙語翻譯,也用作單語翻譯。

用作雙語言時典型的 Weblate 組件配置

文件掩碼

i18n/app.*.ts

單語的基底語言檔

Empty

新翻譯的模板

i18n/app.de.ts

檔案格式

Qt Linguist 翻譯文件

用作單語言時典型的 Weblate 組件配置

文件掩碼

i18n/app.*.ts

單語的基底語言檔

i18n/app.en.ts

新翻譯的模板

i18n/app.en.ts

檔案格式

Qt Linguist 翻譯文件

安卓字符串資源

用於翻譯應用的安卓特定文件格式。

Android string resources are monolingual, the 單語的基底語言檔 is stored in a different location from the other files – res/values/strings.xml.

典型的 Weblate 組件配置

文件掩碼

res/values-*/strings.xml

單語的基底語言檔

res/values/strings.xml

新翻譯的模板

Empty

檔案格式

安卓字符串資源

備註

當前不支持安卓的 string-array 架構。為了解決這個問題,可以將字符串數組分開:

<string-array name="several_strings">
    <item>First string</item>
    <item>Second string</item>
</string-array>

變為:

<string-array name="several_strings">
    <item>@string/several_strings_0</item>
    <item>@string/several_strings_1</item>
</string-array>
<string name="several_strings_0">First string</string>
<string name="several_strings_1">Second string</string>

指向 string 元素的 string-array 應存儲在不同文件中,並且不為翻譯所用。

這個腳本可以幫助預處理現有的 strings.xml 文件和翻譯:https://gist.github.com/paour/11291062

蘋果 iOS 字符串

File format typically used for translating Apple iOS applications, but also standardized by PWG 5100.13 and used on NeXTSTEP/OpenSTEP.

Apple iOS strings are usually used as monolingual.

典型的 Weblate 組件配置

文件掩碼

Resources/*.lproj/Localizable.strings

單語的基底語言檔

Resources/en.lproj/Localizable.stringsResources/Base.lproj/Localizable.strings

新翻譯的模板

Empty

檔案格式

iOS Strings (UTF-8)

PHP 字串

PHP翻譯通常只包含一種語言,因此建議指定(最常見的)帶英語字符串的模板文件。

Joomla 翻譯

<?php
$LANG['foo'] = 'bar';
$LANG['foo1'] = 'foo bar';
$LANG['foo2'] = 'foo bar baz';
$LANG['foo3'] = 'foo bar baz bag';

典型的 Weblate 組件配置

文件掩碼

lang/*/texts.php

單語的基底語言檔

lang/en/texts.php

新翻譯的模板

lang/en/texts.php

檔案格式

PHP strings

Laravel PHP 字串

在 4.1 版本變更.

Laravel PHP 本地化文件也支持複數:

<?php
return [
    'welcome' => 'Welcome to our application',
    'apples' => 'There is one apple|There are many apples',
];

JSON files

在 2.0 版本新加入.

在 2.16 版本變更: 自從 Weblate 2.16 和最早 2.2.4 版本的 translate-toolkit,也支持嵌套結構的 JSON 文件。

在 4.3 版本變更: 即使對於在之前發布版本中中斷的複雜情況,JSON 文件的結構也適當保留。

JSON 格式主要用於翻譯 Javascript 中實施的應用。

Weblate 當前支持 JSON 翻譯的幾個變體:

JSON 翻譯通常是單語言的,因此推薦指定帶有(最經常使用的)英語字符串的翻譯模板文件。

Joomla 翻譯

{
  "Hello, world!\n": "Ahoj světe!\n",
  "Orangutan has %d banana.\n": "",
  "Try Weblate at https://demo.weblate.org/!\n": "",
  "Thank you for using Weblate.": ""
}

也支持嵌套文件(要求請參見上面),這樣的文件看起來像:

{
  "weblate": {
    "hello": "Ahoj světe!\n",
    "orangutan": "",
    "try": "",
    "thanks": ""
  }
}

提示

JSON fileJSON nested structure file 都可以處理相同類型的文件。翻譯時都保留現有的 JSON 架構。

它們之間的唯一區別是使用Weberate添加新字符串時。嵌套結構格式會解析新添加的鍵並將新字符串插入匹配結構。例如,“app.name`”鍵插入為:

{
   "app": {
      "name": "Weblate"
   }
}

典型的 Weblate 組件配置

文件掩碼

langs/translation-*.json

單語的基底語言檔

langs/translation-en.json

新翻譯的模板

Empty

檔案格式

JSON nested structure file

JSON i18next files

在 2.17 版本變更: 由於WebLate 2.17和最少2.2.5的“翻譯 - 工具包”,因此還支持具有復數的I18Next JSON文件。

`i18next <https://www.i18next.com/>`_是編寫的框架和javascript的國際化框架。Webleate支持其本地化文件,其中包含多個功能。

i18ext翻譯是單語,因此建議使用(最常見的)英語字符串指定基本文件。

備註

WebLate支持I18Next JSON V3格式。V2和V1變體主要兼容,但如何處理多個複數。

The v4 variant uses different approach for storing plurals and is currently not supported.

Joomla 翻譯

{
  "hello": "Hello",
  "apple": "I have an apple",
  "apple_plural": "I have {{count}} apples",
  "apple_negative": "I have no apples"
}

典型的 Weblate 組件配置

文件掩碼

langs/*.json

單語的基底語言檔

langs/en.json

新翻譯的模板

Empty

檔案格式

i18next JSON file

也參考

:doc:tt:格式/ json`i18next json格式<https://www.i18next.com/misc/json-format>`_,:ref:ref:更新 - 目標文件,:ref:addon-webblate.json.customize,:ref:addon-webblate.cleanup.generic

go-i18n JSON files

在 4.1 版本新加入.

Go-i18n翻譯是單向的,因此建議使用(最常見的)英語字符串指定基本文件。

備註

Weberate支持Go-i18N JSON V1格式,適用於平面JSON格式,請使用:REF:“JSON”。目前不支持v2格式與哈希。

典型的 Weblate 組件配置

文件掩碼

langs/*.json

單語的基底語言檔

langs/en.json

新翻譯的模板

Empty

檔案格式

go-i18n JSON file

也參考

:doc:tt:格式/ jsongo-i18n,:ref:更新 - 目標文件,:ref:addon-Web2.json.Customize,:ref:addon-weblate.cleanup.generic

ARB File

在 4.1 版本新加入.

ARB翻譯是單語,因此建議使用(最常見的)英語字符串指定基本文件。

典型的 Weblate 組件配置

文件掩碼

lib/l10n/intl_*.arb

單語的基底語言檔

lib/l10n/intl_en.arb

新翻譯的模板

Empty

檔案格式

ARB file

WebExtension JSON

在 2.16 版本新加入: 自苯並2.16以來支持這一點,並且在最小2.2.4中使用`翻譯-Togrukit`_。

在翻譯Mozilla Firefox或Google Chromium的擴展時使用的文件格式。

備註

雖然這種格式稱為JSON,但其規範允許包括註釋,這些註釋不是JSON規範的一部分。WebLate目前不支持註釋。

Joomla 翻譯

{
  "hello": {
    "message": "Ahoj světe!\n",
    "description": "Description",
    "placeholders": {
      "url": {
        "content": "$1",
        "example": "https://developer.mozilla.org"
      }
    }
  },
  "orangutan": {
    "message": "Orangutan has $coUnT$ bananas",
    "description": "Description",
    "placeholders": {
      "count": {
        "content": "$1",
        "example": "5"
      }
    }
  },
  "try": {
    "message": "",
    "description": "Description"
  },
  "thanks": {
    "message": "",
    "description": "Description"
  }
}

典型的 Weblate 組件配置

文件掩碼

_locales/*/messages.json

單語的基底語言檔

_locales/en/messages.json

新翻譯的模板

Empty

檔案格式

WebExtension JSON file

.XML resource files

在 2.3 版本新加入.

一個.xml資源(.resx)文件使用Microsoft .NET應用程序中使用的單格式XML文件格式。它是“互換的.resw,在使用相同的語法到.resx <https://lingohub.com/developers/resource-files/resw-resx-localization>`_。

典型的 Weblate 組件配置

文件掩碼

Resources/Language.*.resx

單語的基底語言檔

Resources/Language.resx

新翻譯的模板

Empty

檔案格式

.NET resource file

ResourceDictionary files

在 4.13 版本新加入.

ResourceDictionary is a monolingual XML file format used to package localizable string resources for Windows Presentation Foundation (WPF) applications.

典型的 Weblate 組件配置

文件掩碼

Languages/*.xaml

單語的基底語言檔

Language/en.xaml

新翻譯的模板

Empty

檔案格式

ResourceDictionary file

CSV 文件

在 2.4 版本新加入.

CSV 文件可以包含源和翻譯的簡單列表。 Weblate 支持以下文件:

  • 帶有標頭定義字段(location, source, target, ID, fuzzy, context, translator_comments, ` developer_comments`)的文件。這是推薦的方法,因為它最不容易出錯。挑選 CSV file 作為一種文件格式。

  • 具有兩個字段的文件 —— 源和翻譯(按此順序),選擇 Simple CSV file 作為文件格式。

  • 無標頭文件字段順序由`translate-toolkit`_: locationsourcetargetIDfuzzycontexttranslator_commentsdeveloper_comments 所定義。選擇 CSV file 作為一種文件格式。

  • 請記住定義:REF:“組件 - 模板”(參見:REF:`Bimono)。

提示

By default, the CSV format does autodetection of file encoding. This can be unreliable in some corner cases and causes performance penalty. Please choose file format variant with encoding to avoid this (for example CSV file (UTF-8)).

警告

CSV 格式當前會自動檢測 CSV 文件的方言。在某些情況下,自動檢測可能會失敗,並且您會得到不同的結果。對於值中包含換行符的 CSV 文件尤其如此。作為一種解決方法,推薦省略引用的字符。

Joomla 翻譯

Thank you for using Weblate.,Děkujeme za použití Weblate.

雙語 CSV 文件的典型Weblate 組件配置

文件掩碼

locale/*.csv

單語的基底語言檔

Empty

新翻譯的模板

locale/en.csv

檔案格式

CSV 文件

單語 CSV 文件的典型 Weblate 組件配置

文件掩碼

locale/*.csv

單語的基底語言檔

locale/en.csv

新翻譯的模板

locale/en.csv

檔案格式

Simple CSV file

Multivalue CSV file

在 4.13 版本新加入.

This variant of the CSV files allows storing multiple translations per string.

也參考

CSV

YAML files

在 2.9 版本新加入.

具有字符串鍵和值的普通yaml文件。Webleate還從列表或詞典中提取字符串。

yaml文件的示例:

weblate:
  hello: ""
  orangutan": ""
  try": ""
  thanks": ""

典型的 Weblate 組件配置

文件掩碼

translations/messages.*.yml

單語的基底語言檔

translations/messages.en.yml

新翻譯的模板

Empty

檔案格式

YAML file

也參考

YAML, Ruby YAML files

Ruby YAML files

在 2.9 版本新加入.

Ruby i18N Yaml文件用語言作為根節點。

示例Ruby I18N Yaml文件:

cs:
  weblate:
    hello: ""
    orangutan: ""
    try: ""
    thanks: ""

典型的 Weblate 組件配置

文件掩碼

translations/messages.*.yml

單語的基底語言檔

translations/messages.en.yml

新翻譯的模板

Empty

檔案格式

Ruby YAML file

也參考

YAML, YAML files

DTD files

在 2.18 版本新加入.

Example DTD file:

<!ENTITY hello "">
<!ENTITY orangutan "">
<!ENTITY try "">
<!ENTITY thanks "">

典型的 Weblate 組件配置

文件掩碼

locale/*.dtd

單語的基底語言檔

locale/en.dtd

新翻譯的模板

Empty

檔案格式

DTD file

也參考

Mozilla DTD format

Flat XML files

在 3.9 版本新加入.

平面XML文件的示例:

<?xml version='1.0' encoding='UTF-8'?>
<root>
  <str key="hello_world">Hello World!</str>
  <str key="resource_key">Translated value.</str>
</root>

典型的 Weblate 組件配置

文件掩碼

locale/*.xml

單語的基底語言檔

locale/en.xml

新翻譯的模板

Empty

檔案格式

Flat XML file

也參考

Flat XML

Windows RC files

在 4.1 版本變更: 對Windows RC文件的支持已被重寫。

備註

對此格式的支持目前在Beta中,歡迎您的測試反饋。

Example Windows RC file:

LANGUAGE LANG_CZECH, SUBLANG_DEFAULT

STRINGTABLE
BEGIN
    IDS_MSG1                "Hello, world!\n"
    IDS_MSG2                "Orangutan has %d banana.\n"
    IDS_MSG3                "Try Weblate at http://demo.weblate.org/!\n"
    IDS_MSG4                "Thank you for using Weblate."
END

典型的 Weblate 組件配置

文件掩碼

狼/*.如此

單語的基底語言檔

狼/恩-US.如此

新翻譯的模板

狼/恩-US.如此

檔案格式

RC file

也參考

Windows RC files

App store 中介資料檔

在 3.5 版本新加入.

可以翻譯用於在各種應用商店中發布應用程序的應用程序的元數據。目前以下工具兼容:

元數據由多個TextFile組成,Web2將作為單獨的字符串呈現要轉換。

典型的 Weblate 組件配置

文件掩碼

fastlane/android/metadata/*

單語的基底語言檔

fastlane/android/metadata/en-US

新翻譯的模板

fastlane/android/metadata/en-US

檔案格式

App store metadata files

提示

如果您不想翻譯某些字符串(例如changelogs),則標記為只讀(請參閱:REF:“自定義檢查”)。這可以通過以下方式自動化:REF:“addon-webblate.flags.bulk`。

Subtitle files

在 3.7 版本新加入.

Weblate can translate various subtitle files:

  • SubRip subtitle file (*.srt)

  • MicroDVD subtitle file (*.sub)

  • 高級變電站alpha字幕文件(* .ass

  • 變電站字母字幕文件(* .ssa

典型的 Weblate 組件配置

文件掩碼

path/*.srt

單語的基底語言檔

path/en.srt

新翻譯的模板

path/en.srt

檔案格式

SubRip subtitle file

也參考

Subtitles

Excel Open XML

在 3.2 版本新加入.

Excel打開XML(.xlsx)文件可以導入和導出。

在上傳用於翻譯的XLSX文件時,請注意,只考慮活動工作表,並且必須至少包含一個名為“源字符串”的列以及稱為“目標”(包含的列)譯文)。此外,應該有一個名為“context``的”列(其中包含翻譯字符串的上下文路徑)。如果使用XLSX下載將翻譯導出到Excel工作簿中,則您已經獲得了具有正確文件格式的文件。

HTML files

在 4.1 版本新加入.

備註

對此格式的支持目前在Beta中,歡迎您的測試反饋。

可翻譯內容從HTML文件中提取,並為翻譯提供。

也參考

HTML

文字檔

在 4.6 版本新加入.

備註

對此格式的支持目前在Beta中,歡迎您的測試反饋。

可翻譯內容從純文本文件中提取,並為翻譯提供。每個段落都被翻譯為單獨的字符串。

There are three flavors of this format:

  • 純文字檔案

  • DokuWiki 文本文件

  • MediaWiki 文本文件

OpenDocument Format

在 4.1 版本新加入.

備註

對此格式的支持目前在Beta中,歡迎您的測試反饋。

可翻譯內容從OpenDocument文件中提取,並為翻譯提供。

IDML Format

在 4.1 版本新加入.

備註

對此格式的支持目前在Beta中,歡迎您的測試反饋。

從Adobe Indesign標記語言文件中提取可翻譯內容,並為翻譯提供。

TermBase eXchange format

在 4.5 版本新加入.

TBX是術語數據交換的XML格式。

典型的 Weblate 組件配置

文件掩碼

tbx/*.tbx

單語的基底語言檔

Empty

新翻譯的模板

Empty

檔案格式

TermBase eXchange file

也參考

`tbx在wikipedia上<https://en.wikipedia.org/wiki/termbase_exchange>`_ ,: doc:tt:格式/ tbx:ref:詞彙表

Stringsdict format

在 4.8 版本新加入.

備註

對此格式的支持目前在Beta中,歡迎您的測試反饋。

XML based format used by Apple which is able to store plural forms of a string.

典型的 Weblate 組件配置

文件掩碼

Resources/*.lproj/Localizable.stringsdict

單語的基底語言檔

Resources/en.lproj/Localizable.stringsdict or Resources/Base.lproj/Localizable.stringsdict

新翻譯的模板

Empty

檔案格式

Stringsdict file

Fluent format

在 4.8 版本新加入.

備註

對此格式的支持目前在Beta中,歡迎您的測試反饋。

Fluent is a monolingual text format that focuses on asymmetric localization: a simple string in one language can map to a complex multi-variant translation in another language.

典型的 Weblate 組件配置

文件掩碼

locales/*/messages.ftl

單語的基底語言檔

locales/en/messages.ftl

新翻譯的模板

Empty

檔案格式

Fluent file

Supporting other formats

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

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