文件扩展名 |
.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":"Check it out!This key has a description!(At least in some formats)" }, { "id": "key_with_line-break", "translation":"This translations contains\na line-break." }, { "id": "nested.deeply.key", "translation":"Wow, this key is nested even deeper." }, { "id": "nested.key", "translation":“这个键嵌套在一个命名空间中。” }, { "id": "null_translation", "translation": null }, { "id": "pluralized_key", "translation": { "one":"Only pluralization found.", "other":"Wow, you have pluralizations!", "zero":"You have no pluralization." } }, { "id": "sample_collection", "translation": "---\n- first item\n- second item\n- third item\n" }, { "id": "simple_key", "translation": "simple key, simple message, so simple." }, { "id": "unverified_key", "translation":"This translation is not yet verified and waits for it.(In some formats we also export this status)" } ]