对于超过 10 MB 的文件,将不会处理 、 和 。
要处理 .ARB 文件,请在创建工作时选择 JSON 文件类型。
文件类型
-
.JSON
导入选项
-
ICU 信息会自动转换为标签。当一个句段包含行内元素时,该句段的 ICU 信息解析将被跳过。没有内联元素的句段将正常解析。
-
导入文件中包含的 HTML 标签。在这种情况下,标签可用于 .HTML 文件导入设置。
若启用,HTML 字符
&和<将被转换为已完成文件中的实体&和<。 -
应用 正则表达式 将指定文本转换为标记。
-
仅导入特定的键(使用 正则表达式)
-
排除特定的键(使用 正则表达式
-
匹配的内容显示在上下文注释中。
-
导入元素或每个元素的译文最大长度。每个句段的字符限制显示在编辑器内的窗口中。所有超出限制的字符都会被标红。
-
如果适用,则构成翻译记忆库上下文匹配(101% 匹配)。
JSON 是 JavaScript 对象表示法的简称。虽然最初仅为 JavaScript 设计,但它已成为与 .XML、.YAML、.Properties 等并行的标准交换文件格式。JSON 由键值对组成,用方括号括起来。值可以是字符串、数字或对象(即一个或多个用方括号括起来的键-值对)。Simple JSON 只是一个 .JSON 文件,除复数外,其大多数值为普通的字符串。在这种情况下,作为值的字符串将是最终被翻译的字符串。
导入设置推荐
JSON 数组是方括号 [] 内的名称-值对列表。JSON 对象是大括号 {} 内的名称-值对列表
-
仅导入特定的键(使用正则表达式):
simple_key|nested.deeply.key-
导入 sample_collection 键后数组所有的值:
(^|.*/)sample_collection\[.*\] -
导入 pluralized_key 键后对象所有的值:
(^|.*/)pluralized_key/.*
-
-
仅排除特定的键(使用正则表达式):
unverified_key -
上下文键:
-
对于具有key_with_description键的值,使用:
/key_with_description -
如果未指定或缺失,则由父键/子键组成。
-
boolean_key 等 JSON 键不能设置为上下文键。
-
示例:
{
"boolean_key": "--- true\n",
"empty_string_translation": "",
"key_with_description":"Check it out!This key has a description!(At least in some formats)",
"key_with_line-break":"这条翻译包含\n换行符。"
"nested.deeply.key":"Wow, this key is nested even deeper.",
"nested.key":"This key is nested inside a namespace.",
"null_translation": null,
"pluralized_key": {
"one":"Only one pluralization found.",
"other":"Wow, you have %s pluralizations!",
"zero":"You have no pluralization."
},
"sample_collection": [
"first item",
"second item",
"third item"
],
"simple_key":"Just a simple key with a simple message.",
"unverified_key":"This translation is not yet verified and waits for it.(In some formats we also export this status)"
}
嵌套 JSON 是 JSON 文件,只是其相当大一部分值是其他 JSON 对象。与 Simple JSON 相比,Nestted JSON 更容易理解,因为它将对象分解为不同的层,更易于维护。
导入设置推荐
JSON 数组是方括号 [] 内的名称-值对列表。JSON 对象是大括号 {} 内的名称-值对列表
-
仅导入特定的键(使用正则表达式):
key_with_line-break|simple_key-
导入 sample_collection 键后数组的值:
(^|.*/)sample_collection\[.*\] -
导入 pluralized_key 键后对象所有的值:
(^|.*/)pluralized_key/.* -
导入第一个 key 的键值:
nested/deeply/key -
导入第二个 key 的键值:
nested/key -
导入不分级别的 key 键值:
(^|.*/)key
-
-
仅排除特定的键(使用正则表达式):
unverified_key -
上下文键:
-
对于具有键key_with_description的值,使用:
/key_with_description -
如果未指定或缺失,则由父键/子键组成。
-
boolean_key 等 JSON 键不能设置为上下文键。
-
示例:
{
"boolean_key": "--- true\n",
"empty_string_translation": "",
"key_with_description":"Check it out!This key has a description!(At least in some formats)",
"key_with_line-break":"This translations contains\na line-break.",
"nested": {
"deeply": {
"key":"Wow, this key is nested even deeper."
},
"key":"This key is nested inside a namespace."
},
"null_translation": null,
"pluralized_key": {
"one":"Only one pluralization found.",
"other":"Wow, you have %s pluralizations!",
"zero":"You have no pluralization."
},
"sample_collection": [
"first item",
"second item",
"third item"
],
"simple_key":"Just a simple key with a simple message.",
"unverified_key":"This translation is not yet verified and waits for it.(In some formats we also export this status)"
}
React-Intl 是一个专为简化国际化(及本地化)而设计的 JavaScript 库,主要适用于在 React 中开发的应用程序。默认情况下,React-Intl 使用 .js 文件存储其本地化内容。
导入设置推荐
JSON 数组是方括号 [] 内的名称-值对列表。
-
仅导入特定的键(使用正则表达式):
key_with_line-break|nested.deeply.key-
要导入紧跟在 sample_collection 键后的数组所有值:
(^|.*/)sample_collection\[.*\]
-
-
仅排除特定的键(使用正则表达式):
未验证_key -
上下文键:
-
对于具有key_with_description键的值,使用:
/key_with_description -
如果未指定或缺失,则由父键/子键构成。
-
boolean_key 等 JSON 键不能设置为上下文键。
-
示例:
{
"boolean_key": "--- true\n",
"empty_string_translation": "",
"key_with_description":"Check it out!This key has a description!(At least in some formats)",
"key_with_line-break":"该翻译包含\n换行符",
"nested.deeply.key":"I'm a deeply nested key.",
"nested.key":"This key is nested inside a namespace.",
"null_translation": null,
"pluralized_key.one":"Only one kitten found.",
"pluralized_key.other":"Wow, you have %s kittens!",
"pluralized_key.zero":"You have no kittens.",
"sample_collection": [
"first item",
"second item",
"third item"
],
"simple_key":"Simple key, simple message, so simple.",
"unverified_key":"This translation is not yet verified and waits for it.(In some formats we also export this status)"
}
React-Intl 是一个专为简化国际化(及本地化)而设计的 JavaScript 库,主要适用于在 React 中开发的应用程序。默认情况下,React-Intl 使用 .js 文件存储其本地化内容。
导入设置推荐
JSON 数组是方括号 [] 内的名称-值对列表。JSON 对象是大括号 {} 内的名称-值对列表
-
仅导入特定的键(使用正则表达式):
key_with_line-break|simple_key-
要导入紧跟在 sample_collection 键后的数组所有值:
(^|.*/)sample_collection\[.*\] -
导入 pluralized_key 键后对象所有的值:
(^|.*/)pluralized_key/.* -
导入第一个 key 的键值:
nested/deeply/key -
导入第二个 key 的键值:
nested/key -
要导入不论层级的 key 键的值:
(^|.*/)key
-
-
仅排除特定的键(使用正则表达式):
未验证_key -
上下文键:
-
对于具有key_with_description键的值,使用:
/key_with_description -
如果未指定或缺失,则由父键/子键组成。
-
boolean_key 等 JSON 键不能设置为上下文键。
-
示例:
{
"boolean_key": "--- true\n",
"empty_string_translation": "",
"key_with_description":"Check it!This key has a description!(At least in some formats it does)",
"key_with_line-break":"This translations contains\na line-break.",
"nested": {
"deeply": {
"key":"Hey, this key is nested even deeper."
},
"key":"This key is nested inside a namespace."
},
"null_translation": null,
"pluralized_key": {
"one":"Only one pluralization found.",
"other":"Wow, you have %s pluralizations!",
"zero":"You have no pluralization."
},
"sample_collection": [
"first item",
"second item",
"third item"
],
"simple_key":"A simple key with a simple message.",
"unverified_key":"Translation is not yet verified and waits for it.(In some formats we also export this status)"
}
Chrome 扩展的本地化字符串存储在一个通常名为 messages.json 的文件中。Chrome JSON 文件与其他平台上用于本地化的 .JSON 文件的结构略有不同。对于 Chrome JSON,需要翻译的字符串被放置在嵌套在每个单位键值对下的子键信息中。用户也可为每个键值对添加说明。
导入设置推荐
JSON 对象是由名称-值对组成的列表,包含在大括号 {} 中。
-
仅导入特定的键(使用正则表达式):
.*/message|.*/content-
仅导入 message 键的第一个值:
prompt_for_name/message -
导入 user 键后对象的所有值:
.*/user/.*
-
-
仅排除特定的键(使用正则表达式):
.*/example -
上下文注释:
-
对于具有 description 键的值:
../description -
如果未指定或缺失,则由父/子键键成。
-
prompt_for_name 等 JSON 键不能设置为上下文注释。
-
-
转换为 Phrase 标签:
\$[^\$]+\$
示例:
{
"prompt_for_name": {
"message":"What's your name?",
"description":"Ask for the user's name"
},
"hello": {
"message":"Hello, $USER$",
"description":"Greet the user",
"placeholders": {
"user": {
"content": "$1",
"example":"Cira"
}
}
},
"bye": {
"message":"Goodbye, $USER$.Come back to $OUR_SITE$ soon!",
"description":"Say goodbye to the user",
"placeholders": {
"our_site": {
"content":"Example.com"
},
"user": {
"content": "$1",
"example":"Cira"
}
}
}
}
Go-i18n 是一个专为 Golang 设计的国际化库,支持的本地化文件格式有 JSON、YAML、TOML 等。Go-i18n 使用的 JSON 文件与其他本地化/国际化平台的文件不同,因为 Go-i18n JSON 通常作为一个 JSON 数组存在,由一系列 JSON 对象组成。每个 JSON 对象代表需要翻译的字符串,由 ID 等键表示。
导入设置推荐
JSON 对象是大括号 {} 内的名称-值对列表。
-
仅导入特定的键(使用正则表达式):
.*/translation-
导入 translation 键后对象所有的值:
.*/translation/.* -
仅导入 translation 键后第二个对象的值:
.*\[2\]/translation/.* -
导入 translation 键后对象中的一个键的值:
.*/translation/one -
导入 5th translation 键中一个键的值:
.*\[5\]/translation/one -
导入 translation 键后对象中其他键的值:
(^|.*/)translation/other -
要导入在 translation 键之后的第 2 个对象中其他键的值:
.*\[2\]/translation/other
-
-
仅排除特定的键(使用正则表达式):
.*/other -
上下文键:
-
对于具有 ID 键的值,使用:
../id -
如果未指定或缺失,则由父/子键键成。
-
one 等 JSON 键不能设置为上下文键。
-
-
转换为 Phrase 标签:
\{\{[^\}]+\}\}
示例:
[
{
"id": "d_days",
"translation": {
"one": "{{.Count}} day",
"other": "{{.Count}} days"
}
},
{
"id": "my_height_in_meters",
"translation": {
"one":"I am {{.Count}} meter tall.",
"other":"I am {{.Count}} meters tall."
}
},
{
"id": "person_greeting",
"translation":"Hello {{.Person}}"
},
{
"id": "person_unread_email_count",
"translation": {
"one": "{{.Person}} has {{.Count}} unread email.",
"other": "{{.Person}} has {{.Count}} unread emails."
}
},
{
"id": "person_unread_email_count_timeframe",
"translation": {
"one": "{{.Person}} has {{.Count}} unread email in the past {{.Timeframe}}.",
"other": "{{.Person}} has {{.Count}} unread emails in the past {{.Timeframe}}."
}
},
{
"id": "program_greeting",
"translation":"Hello world"
},
{
"id": "your_unread_email_count",
"translation": {
"one":"You have {{.Count}} unread email.",
"other":"You have {{.Count}} unread emails."
}
}
]
i18n-node-2 是基于 Node.js 的库,可与 Express.js 一起使用。i18n-node-2 通过立即提取字符串与应用程序集成。i18n-node-2 是将待翻译的字符串包装起来所需的所有必要工具。在运行时,i18n-node-2 会根据预定义的区域自动生成多个 JSON 文件。i18n-node-2 使用自动生成的 JSON 格式式存储可译的数据。在翻译之前,对文件进行健全性检查。由于 i18n-node-2 支持复数,因此在翻译过程中确保了所有变量保持不变。
导入设置推荐
JSON 数组是方括号 [] 内的名称-值对列表。JSON 对象是大括号 {} 内的名称-值对列表
-
仅导入特定的 键(使用正则表达式):
simple_key|nested.deeply.key-
要导入在 sample_collection 键之后的数组中的所有值:
(^|.*/)sample_collection\[.*\] -
要导入在 pluralized_key 键之后的对象中的所有值:
(^|.*/)pluralized_key/.*
-
-
仅排除特定的键(使用正则表达式):
unverified_key -
上下文键:
-
要获取 key_with_description 键的值,请使用:
/key_with_description -
如果未指定或缺失,则由父键/子键组成。
-
boolean_key 等 JSON 键不能设置为上下文键。
-
示例:
{
"boolean_key": "--- true\n",
"empty_string_translation": "",
"key_with_description":"Check it out!This key has a description!(At least in some formats)",
"key_with_line-break":"该翻译包含\n换行符。",
"nested.deeply.key":"I'm a deeply nested key.",
"nested.key":"This key is nested inside a namespace.",
"null_translation": null,
"pluralized_key": {
"one":"Only one pluralization found.",
"other":"Wow, you have %s pluralizations!",
"zero":"You have no pluralization."
},
"sample_collection": [
"first item",
"second item",
"third item"
],
"simple_key": "简单键,简单消息,就是这么简单。"
"unverified_key":"This translation is not yet verified and waits for it.(In some formats we also export this status)"
}