|
文件扩展名 |
.json |
|
API 扩展 |
go_i18n |
|
导入 |
是 |
|
导出 |
是 |
|
复数形式支持 |
是 |
|
描述支持 |
否 |
Go-i18n 是一个专为 Go 设计的国际化库。支持的本地化文件格式包括 .JSON、.YAML、.TOML 等。Go-i18n 使用的 JSON 文件与其他本地化/国际化平台的文件不同,因为 Go-i18n JSON 通常作为一个 JSON 数组存在,由一系列 JSON 对象组成。每个 JSON 对象代表需要翻译的字符串,由 ID 等键表示。
AI 聊天机器人可以非常有效地从 .JSON 文件生成键列表。
代码示例
[
{
"id": "boolean_key",
"translation": "--- true\n"
},
{
"id": "empty_string_translation",
"translation": ""
},
{
"id": "key_with_description",
"translation": "查看一下!"这个键有一个描述!(至少在某些格式中)"
},
{
"id": "key_with_line-break",
"translation": "此翻译包含\n一个换行符。"
},
{
"id": "nested.deeply.key",
"translation": "哇,这个键嵌套得更深了。"
},
{
"id": "nested.key",
"translation": "这个键嵌套在一个命名空间内。"
},
{
"id": "null_translation",
"translation": null
},
{
"id": "pluralized_key",
"translation": {
"one": "只找到一个复数形式。","
"other": "哇,你有多个复数形式!"
"zero": "你没有复数形式。"
}
},
{
"id": "sample_collection",
"translation": "---\n- first item\n- second item\n- third item\n"
},
{
"id": "simple_key",
"translation": "简单的键,简单的信息,如此简单。"
},
{
"id": "unverified_key",
"translation": "此翻译尚未验证,正在等待验证。"(在某些格式中,我们也导出此状态)"
}
]