go-i18n JSON 檔案¶
在 4.1 版被加入.
在 4.16 版的變更: 新增了對此格式 v2 變體的支援。
go-i18n 翻譯採用單語格式,因此建議指定包含英文字串(最常見的情況)的基礎檔案。
備註
Weblate 支援 go-i18n JSON v1 和 v2 變體。請選擇相符您環境的正確檔案格式。
範例檔案¶
範例檔案 v1:
[
{
"id": "hello",
"description": "Description",
"translation": "Ahoj světe!\n"
},
{
"id": "orangutan",
"description": "Description",
"translation": {
"one": "Orangutan has {{.Count}} banana.\n",
"other": "Orangutan has {{.Count}} bananas.\n"
}
},
{
"id": "try",
"description": "Description",
"translation": ""
},
{
"id": "thanks",
"description": "Description",
"translation": ""
}
]
範例檔案 v2:
{
"hello": "Ahoj světe!\n",
"orangutan": {
"description": "Description",
"one": "Orangutan has {{.Count}} banana.\n",
"other": "Orangutan has {{.Count}} bananas.\n"
},
"try": {
"description": "Description",
"other": ""
},
"thanks": {
"description": "Description",
"other": ""
}
}
Weblate 設定¶
v1 的典型 Weblate 元件設定 |
|
|---|---|
檔案遮罩 |
|
單語言基底語言檔案 |
|
新翻譯的範本 |
空白 |
檔案格式 |
go-i18n v1 JSON 檔案 |
v2 的典型 Weblate 元件設定 |
|
|---|---|
檔案遮罩 |
|
單語言基底語言檔案 |
|
新翻譯的範本 |
空白 |
檔案格式 |
go-i18n v2 JSON 檔案 |