|
文件扩展名 |
.json |
|
API 扩展 |
i18next / i18next_4 |
|
导入 |
是 |
|
导出 |
是 |
|
复数形式支持 |
是 |
|
描述支持 |
否 |
|
格式选项 这些选项可以在文件上传和/或下载时指定。根据上传/下载方法(API、CLI、Repo同步等),它们可以在查询参数 |
嵌套 |
i18next 和 i18nextV4 是 JavaScript 库,为基于 JavaScript 的各种环境提供易于使用的本地化和国际化解决方案。作为最古老的 l10n/i18n 库之一,它支持标准的 i18n 库功能,如插值和复数,并能很好地处理异步请求。配置后,它可以通过检测浏览器语言设置来自动加载特定区域的数据。
与其他 JavaScript l10n/i18n 库一样,i18next 和 i18nextV4 使用 JSON 格式存储翻译。待翻译的字符串要么直接放在值处,要么嵌套在另一个对象内部(例如内插值)。翻译时,确保所有变量都保持不变。
如果使用 i18nextV4,上传时选择 格式。
AI 聊天机器人可以非常有效地从 .JSON 文件生成键列表。
两个版本对复数的处理不同。确定复数键:
支持:
-
复数
-
以 _0、_1、_other 等结尾的键将被映射到相应的复数形式。
-
-
命名空间
-
阵列
不支持:
-
区间复数 作为正常键值保留。用户界面不支持。
-
i18next 嵌套 / 变量替换 不直接支持,但可以引用翻译内容中的其他键,并且可以激活占位符。不支持在值中进行键的交叉引用。用户界面不支持。
格式选项
|
标识符 |
嵌套 |
|
类型 |
布尔值 |
|
上传 |
否 |
|
下载 |
是 |
|
默认 |
true |
|
说明 |
导出翻译文件时,键是根据键名中的点嵌套的。设置为 |
代码示例 (i18next_4)
{
"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": "",
"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)",
"pluralized_key_one":"Only one pluralization found.",
"pluralized_key_other":"Wow, you have %s pluralizations!"
}
代码示例(i18next)
{
"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": "",
"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)",
"pluralized_key":"Only one pluralization found.",
"pluralized_key_plural":"Wow, you have %s pluralizations!",
"pluralized_keyWithCount": "{{count}} 找到的复数形式。","
"pluralized_keyWithCount_plural":"Wow, you have {{count}} pluralizations!"
}