支持的文件格式

Weblate 支持 translate-toolkit 理解的大多数翻译格式,但是每种格式都略有不同,一些未经充分测试的格式可能会出现问题。

备注

为您的应用程序选择文件格式时,最好在您使用的工具包/平台中保留一些支持完善的格式。这样,您的翻译人员可以额外使用他们习惯使用的任何工具,并且更有可能为您的项目作贡献。

双语和单语格式

支持 monolingual 和 bilingual 格式。双语格式在单个文件中存储两种语言文本——原文和译文(典型示例是 GNU gettextXLIFF苹果 iOS 字符串 字符串)。另一方面,单语格式通过 ID 识别字符串,每个语言文件仅包含那些语言到任何给定语言(典型为 Android 字符串资源)的映射。两种变体都使用某些文件格式,请参见下面的详细说明。

为了正确使用单语文件,Weblate 需要访问一个包含要翻译的字符串及其原文的完整列表的文件——该文件在 Weblate 中被称为 单语言译文模版语言文件,尽管命名上和你的叫法可能会有所不同。

另外,可以利用 中间语言文件 扩展此工作流程,以包括开发人员提供的字符串,但不要在最终的字符串中使用。

自动检测

Weblate 可以自动检测几种常用的文件格式,但是这种检测会损害您的性能,并且会限制特定于给定文件格式的功能(例如,自动添加新翻译)。

翻译类型功能

所有受支持格式的功能:

格式

语言能力 1

复数 2

描述 3

上下文 4

位置 5

标记 8

更多状态 6

GNU gettext

双语

支持

支持

支持

支持

支持 9

需要编辑

单语 gettext

单语

支持

支持

支持

支持

支持 9

需要编辑

XLIFF

二者

支持

支持

支持

支持

支持 10

需要编辑、已批准

Java 属性

二者

不支持

支持

不支持

不支持

不支持

mi18n 语言文件

单语

不支持

支持

不支持

不支持

不支持

GWT 属性

单语

支持

支持

不支持

不支持

不支持

Joomla 翻译

单语

不支持

支持

不支持

支持

不支持

Qt Linguist .ts

二者

支持

支持

不支持

支持

支持 10

需要编辑

Android 字符串资源

单语

支持

支持 7

不支持

不支持

支持 10

苹果 iOS 字符串

双语

不支持

支持

不支持

不支持

不支持

PHP 字符串

单语

不支持 11

支持

不支持

不支持

不支持

JSON 文件

单语

不支持

不支持

不支持

不支持

不支持

JSON i18next 文件

单语

支持

不支持

不支持

不支持

不支持

go-i18n JSON 文件

单语

支持

不支持

不支持

不支持

不支持

ARB 文件

单语

支持

支持

不支持

不支持

不支持

WebExtension JSON

单语

支持

支持

不支持

不支持

不支持

.XML 资源文件

单语

不支持

支持

不支持

不支持

支持 10

CSV 文件

二者

不支持

支持

支持

支持

不支持

需要编辑

YAML 文件

单语

不支持

支持

不支持

不支持

不支持

Ruby YAML 文件

单语

支持

支持

不支持

不支持

不支持

DTD 文件

单语

不支持

不支持

不支持

不支持

不支持

Flat XML 文件

单语

不支持

不支持

不支持

不支持

支持 10

Windows RC 文件

单语

不支持

支持

不支持

不支持

不支持

Excel Open XML

单语

不支持

支持

支持

支持

不支持

需要编辑

应用商店元数据文件

单语

不支持

不支持

不支持

不支持

不支持

字幕文件

单语

不支持

不支持

不支持

支持

不支持

HTML 文件

单语

不支持

不支持

不支持

不支持

不支持

OpenDocument 格式

单语

不支持

不支持

不支持

不支持

不支持

IDML 格式

单语

不支持

不支持

不支持

不支持

不支持

INI 翻译

单语

不支持

不支持

不支持

不支持

不支持

Inno Setup INI 翻译

单语

不支持

不支持

不支持

不支持

不支持

TermBase eXchange 格式

双语

不支持

支持

不支持

不支持

支持 10

文本文件

单语

不支持

不支持

不支持

不支持

不支持

Stringsdict 格式

单语

支持

支持

不支持

不支持

不支持

Fluent 格式

单语

不支持 12

支持

不支持

不支持

不支持

1

请参见 双语和单语格式

2

复数是正确本地化具有可变计数的字符串所必需的。

3

源字符串描述可用于传递要翻译的字符串的附加信息。

4

上下文用于区分在不同领域使用的相同字符串(例如 Sun 可以是 “Sunday” 的缩写,也可以是离我们最近的恒星的名字)。

5

字符串在源代码中的位置可能会帮助经验丰富的译者弄清楚字符串是如何使用的。

6

除“Untranslated”(未翻译)和“Translated”(已翻译)之外,文件格式支持的更多状态。

7

放在 <string> 元素前的 XML 注释,解析为源字符串描述。

8

请参见 使用标记定制行为

9(1,2)

gettext 类型的注释用作标记。

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

对于所有基于 XML 的格式,标记是从非标准属性 weblate-flags 中提取的。此外,还通过 XLIFF 标准中定义的 maxwidth 属性 支持了 max-length:N,请参阅 指定翻译标记

11

只有 Laravel 支持复数,它使用字符串语法来定义复数,请参见 Localization in Laravel

12

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

只读字符串

3.10 新版功能.

翻译文件中的只读字符串将被包含在 Weblate 中,但不能在 Weblate 中对其进行编辑。只有少数格式(XLIFFAndroid 字符串资源)原生支持此功能,但可以通过添加 read-only 标记在其他格式中进行模拟,请参阅 使用标记定制行为

GNU gettext

翻译自由软件用得最广泛的格式。

支持通过调整文件标头或链接到相应的源文件,在文件中存储上下文信息。

双语 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

单语言译文模版语言文件

新翻译的译文模版

po/messages.pot

文件格式

Gettext PO 文件

单语 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 也支持其作为单语言格式。

参见

XML Localization Interchange File Format (XLIFF) 规范

翻译状态

在 3.3 版更改: 3.3 版本前的 Weblate 忽略 state 属性。

文件中的 state 属性在 Weblate 中被部分处理并映射为 “Needs edit” (需要编辑)的状态(如果出现目标的话,后面的状态用于将字符串标记为需要编辑: newneeds-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 属性指定附加的翻译标记(请参见 使用标记定制行为)。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 ,当命名字符集时请记住这些请参见 管理字型)。

字符串键

Weblate 通过 resname 属性(如果有的话)识别 XLIFF 文件中的单元,并会回退到 id (如果有的话,则与 file 标签一起)。

resname 属性被认为是人类友好的单元标识符,这也使其比 id 更适合 Weblate 显示。在整个 XLIFF 文件中 resname 必须是唯一的。这是 Weblate 的要求,XLIFF 标准没有涉及到这一点——它没有对此属性施加任何唯一性限制。

用于双语言 XLIFF 的典型 Weblate 部件配置

文件掩码

localizations/*.xliff

单语言译文模版语言文件

新翻译的译文模版

localizations/en-US.xliff

文件格式

XLIFF 翻译文件

用于单语言 XLIFF 的典型 Weblate 部件配置

文件掩码

localizations/*.xliff

单语言译文模版语言文件

localizations/en-US.xliff

新翻译的译文模版

localizations/en-US.xliff

文件格式

XLIFF 翻译文件

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

新翻译的译文模版

文件格式

Java Properties (ISO-8859-1)

mi18n 语言文件

4.7 新版功能.

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

典型的 Weblate 部件配置

文件掩码

*.lang

单语言译文模版语言文件

en-US.lang

新翻译的译文模版

文件格式

mi18n 语言文件

GWT 属性

GWT 原生翻译格式。

GWT 属性通常用作单语言翻译。

典型的 Weblate 部件配置

文件掩码

src/app/Bundle_*.properties

单语言译文模版语言文件

src/app/Bundle.properties

新翻译的译文模版

文件格式

GWT 属性

INI 翻译

4.1 新版功能.

用于翻译的 INI 文件格式。

INI 翻译通常用作单语言翻译。

典型的 Weblate 部件配置

文件掩码

language/*.ini

单语言译文模版语言文件

language/en.ini

新翻译的译文模版

文件格式

INI 文件

备注

Weblate 只从 INI 文件内的章节中提取键。在您的 INI 文件缺乏章节的情况下,会想要替代使用 Joomla 翻译Java 属性

Inno Setup INI 翻译

4.1 新版功能.

用于翻译的 Inno Setup INI 文件格式。

Inno Setup INI 翻译,通常用作单语言翻译。

备注

唯一需要注意的差异是 INI 翻译 支持 %n%t 占位符用于换行和制表符。

典型的 Weblate 部件配置

文件掩码

language/*.islu

单语言译文模版语言文件

language/en.islu

新翻译的译文模版

文件格式

Inno Setup INI 文件

备注

当前只支持 Unicode 文件(.islu),当前不支持 ANSI 变体(.isl)。

Joomla 翻译

2.12 新版功能.

Joomla 原生翻译格式。

Joomla 翻译通常用作单语言翻译。

典型的 Weblate 部件配置

文件掩码

language/*/com_foobar.ini

单语言译文模版语言文件

language/en-GB/com_foobar.ini

新翻译的译文模版

文件格式

Joomla 语言文件

Qt Linguist .ts

基于 Qt 的应用中使用的翻译格式。

Qt Linguist 文件既用作双语翻译,也用作单语翻译。

用作双语言时典型的 Weblate 部件配置

文件掩码

i18n/app.*.ts

单语言译文模版语言文件

新翻译的译文模版

i18n/app.de.ts

文件格式

Qt Linguist 翻译文件

用作单语言时典型的 Weblate 部件配置

文件掩码

i18n/app.*.ts

单语言译文模版语言文件

i18n/app.en.ts

新翻译的译文模版

i18n/app.en.ts

文件格式

Qt Linguist 翻译文件

Android 字符串资源

用于翻译应用的 Android 特定文件格式。

Android 字符串资源是单语言的,单语言译文模版语言文件 存储在与其他文件不同的位置 – res/values/strings.xml

典型的 Weblate 部件配置

文件掩码

res/values-*/strings.xml

单语言译文模版语言文件

res/values/strings.xml

新翻译的译文模版

文件格式

Android 字符串资源

备注

当前不支持 Android 的 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 字符串

用于翻译应用的苹果特定文件格式,用于 iOS 和 iPhone/iPad 应用的翻译。

苹果 iOS 字符串通常用作双语翻译。

典型的 Weblate 部件配置

文件掩码

Resources/*.lproj/Localizable.strings

单语言译文模版语言文件

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

新翻译的译文模版

文件格式

iOS 字符串 (UTF-8)

PHP 字符串

PHP翻译通常只包含一种语言,因此建议指定(最常见的)带英语字符串的模板文件。

示例文件:

<?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 字符串

Laravel PHP 字符串

在 4.1 版更改.

Laravel PHP 本地化文件也支持复数:

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

JSON 文件

2.0 新版功能.

在 2.16 版更改: 自从 Weblate 2.16 和最早 2.2.4 版本的 translate-toolkit,也支持嵌套结构的 JSON 文件。

在 4.3 版更改: 即使对于在之前发布版本中中断的复杂情况,JSON 文件的结构也适当保留。

JSON 格式主要用于翻译用 JavaScript 实现的应用程序。

Weblate 目前支持 JSON 翻译的几种变体:

JSON 翻译通常是单语言的,因此推荐指定带有(最经常使用的)英语字符串的翻译模板文件。

示例文件:

{
  "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 文件JSON 嵌套结构文件 都可以处理相同类型的文件。翻译时都保留现有的 JSON 架构。

The only difference between them is when adding new strings using Weblate. The nested structure format parses the newly added key and inserts the new string into the matching structure. For example app.name key is inserted as:

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

典型的 Weblate 部件配置

文件掩码

langs/translation-*.json

单语言译文模版语言文件

langs/translation-en.json

新翻译的译文模版

文件格式

JSON 嵌套结构文件

JSON i18next 文件

在 2.17 版更改: Since Weblate 2.17 and with translate-toolkit at-least 2.2.5, i18next JSON files with plurals are supported as well.

i18next is an internationalization framework written in and for JavaScript. Weblate supports its localization files with features such as plurals.

i18next translations are monolingual, so it is recommended to specify a base file with (what is most often the) English strings.

备注

Weblate supports the i18next JSON v3 format. The v2 and v1 variants are mostly compatible, with exception of how plurals are handled.

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

示例文件:

{
  "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

新翻译的译文模版

文件格式

i18next JSON 文件

go-i18n JSON 文件

4.1 新版功能.

go-i18n translations are monolingual, so it is recommended to specify a base file with (what is most often the) English strings.

备注

Weblate supports the go-i18n JSON v1 format, for flat JSON formats please use JSON 文件. The v2 format with hash is currently not supported.

典型的 Weblate 部件配置

文件掩码

langs/*.json

单语言译文模版语言文件

langs/en.json

新翻译的译文模版

文件格式

go-i18n JSON 文件

ARB 文件

4.1 新版功能.

ARB translations are monolingual, so it is recommended to specify a base file with (what is most often the) English strings.

典型的 Weblate 部件配置

文件掩码

lib/l10n/intl_*.arb

单语言译文模版语言文件

lib/l10n/intl_en.arb

新翻译的译文模版

文件格式

ARB 文件

WebExtension JSON

2.16 新版功能: This is supported since Weblate 2.16 and with translate-toolkit at-least 2.2.4.

File format used when translating extensions for Mozilla Firefox or Google Chromium.

备注

While this format is called JSON, its specification allows to include comments, which are not part of JSON specification. Weblate currently does not support file with comments.

示例文件:

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

典型的 Weblate 部件配置

文件掩码

_locales/*/messages.json

单语言译文模版语言文件

_locales/en/messages.json

新翻译的译文模版

文件格式

WebExtension JSON 文件

.XML 资源文件

2.3 新版功能.

A .XML resource (.resx) file employs a monolingual XML file format used in Microsoft .NET applications. It is interchangeable with .resw, when using identical syntax to .resx.

典型的 Weblate 部件配置

文件掩码

Resources/Language.*.resx

单语言译文模版语言文件

Resources/Language.resx

新翻译的译文模版

文件格式

.NET 资源文件

CSV 文件

2.4 新版功能.

CSV 文件可以包含一个原文和译文的简单列表。Weblate 支持以下文件:

  • 带有标头定义字段(location, source, target, ID, fuzzy, context, translator_comments, developer_comments)的文件。这是推荐的方法,因为它最不容易出错。挑选 CSV file 作为一种文件格式。

  • 具有两个字段的文件——原文和译文(按此顺序),选择 简单 CSV 文件 作为文件格式。

  • 无标头文件,其字段按 translate-toolkit 定义的顺序排列:locationsourcetargetIDfuzzycontexttranslator_commentsdeveloper_comments。选择 CSV 文件 作为文件格式。

  • Remember to define 单语言译文模版语言文件 when your files are monolingual (see 双语和单语格式).

警告

CSV 格式当前会自动检测 CSV 文件的方言。在某些情况下,自动检测可能会失败,您会得到不同的结果。对于值中包含换行符的 CSV 文件尤其如此。解决方法是建议省略引号字符。

示例文件:

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

双语 CSV 文件的典型Weblate 部件配置

文件掩码

locale/*.csv

单语言译文模版语言文件

新翻译的译文模版

locale/en.csv

文件格式

CSV 文件

单语 CSV 文件的典型 Weblate 部件配置

文件掩码

locale/*.csv

单语言译文模版语言文件

locale/en.csv

新翻译的译文模版

locale/en.csv

文件格式

简单 CSV 文件

参见

CSV

YAML 文件

2.9 新版功能.

The plain YAML files with string keys and values. Weblate also extract strings from lists or dictionaries.

Example of a YAML file:

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

典型的 Weblate 部件配置

文件掩码

translations/messages.*.yml

单语言译文模版语言文件

translations/messages.en.yml

新翻译的译文模版

文件格式

YAML 文件

Ruby YAML 文件

2.9 新版功能.

Ruby i18n YAML files with language as root node.

Example Ruby i18n YAML file:

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

典型的 Weblate 部件配置

文件掩码

translations/messages.*.yml

单语言译文模版语言文件

translations/messages.en.yml

新翻译的译文模版

文件格式

Ruby YAML 文件

参见

YAML, YAML 文件

DTD 文件

2.18 新版功能.

Example DTD file:

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

典型的 Weblate 部件配置

文件掩码

locale/*.dtd

单语言译文模版语言文件

locale/en.dtd

新翻译的译文模版

文件格式

DTD 文件

Flat XML 文件

3.9 新版功能.

Example of a flat XML file:

<?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

新翻译的译文模版

文件格式

Flat XML 文件

参见

Flat XML

Windows RC 文件

在 4.1 版更改: Support for Windows RC files has been rewritten.

备注

Support for this format is currently in beta, feedback from testing is welcome.

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 部件配置

文件掩码

lang/*.rc

单语言译文模版语言文件

lang/en-US.rc

新翻译的译文模版

lang/en-US.rc

文件格式

RC 文件

应用商店元数据文件

3.5 新版功能.

Metadata used for publishing apps in various app stores can be translated. Currently the following tools are compatible:

The metadata consists of several textfiles, which Weblate will present as separate strings to translate.

典型的 Weblate 部件配置

文件掩码

fastlane/android/metadata/*

单语言译文模版语言文件

fastlane/android/metadata/en-US

新翻译的译文模版

fastlane/android/metadata/en-US

文件格式

应用商店元数据文件

提示

In case you don’t want to translate certain strings (for example changelogs), mark them read-only (see 使用标记定制行为). This can be automated by the 批量编辑.

字幕文件

3.7 新版功能.

Weblate 可以翻译各种字幕文件:

  • SubRip 字幕文件 (*.srt)

  • MicroDVD 字幕文件 (*.sub)

  • Advanced SubStation Alpha 字幕文件 (*.ass)

  • SubStation Alpha 字幕文件 (*.ssa)

典型的 Weblate 部件配置

文件掩码

path/*.srt

单语言译文模版语言文件

path/en.srt

新翻译的译文模版

path/en.srt

文件格式

SubRip 字幕文件

参见

Subtitles

Excel Open XML

3.2 新版功能.

Excel Open XML (.xlsx) files can be imported and exported.

When uploading XLSX files for translation, be aware that only the active worksheet is considered, and there must be at least a column called source (which contains the source string) and a column called target (which contains the translation). Additionally there should be the column called context (which contains the context path of the translation string). If you use the XLSX download for exporting the translations into an Excel workbook, you already get a file with the correct file format.

HTML 文件

4.1 新版功能.

备注

Support for this format is currently in beta, feedback from testing is welcome.

The translatable content is extracted from the HTML files and offered for the translation.

参见

HTML

文本文件

4.6 新版功能.

备注

Support for this format is currently in beta, feedback from testing is welcome.

The translatable content is extracted from the plain text files and offered for the translation. Each paragraph is translated as a separate string.

这种格式有三种风格:

  • 纯文本文件

  • DokuWiki 文本文件

  • MediaWiki 文本文件

OpenDocument 格式

4.1 新版功能.

备注

Support for this format is currently in beta, feedback from testing is welcome.

The translatable content is extracted from the OpenDocument files and offered for the translation.

IDML 格式

4.1 新版功能.

备注

Support for this format is currently in beta, feedback from testing is welcome.

The translatable content is extracted from the Adobe InDesign Markup Language files and offered for the translation.

TermBase eXchange 格式

4.5 新版功能.

TBX is an XML format for the exchange of terminology data.

典型的 Weblate 部件配置

文件掩码

tbx/*.tbx

单语言译文模版语言文件

新翻译的译文模版

文件格式

TermBase eXchange 文件

Stringsdict 格式

4.8 新版功能.

备注

Support for this format is currently in beta, feedback from testing is welcome.

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.stringsdictResources/Base.lproj/Localizable.stringsdict

新翻译的译文模版

文件格式

Stringsdict 文件

Fluent 格式

4.8 新版功能.

备注

Support for this format is currently in beta, feedback from testing is welcome.

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

新翻译的译文模版

文件格式

Fluent 文件

支持其他格式

Most formats supported by translate-toolkit which support serializing can be easily supported, but they did not (yet) receive any testing. In most cases some thin layer is needed in Weblate to hide differences in behavior of different translate-toolkit storages.

To add support for a new format, the preferred approach is to first implement support for it in the translate-toolkit.