go-i18n JSON 檔

Added in version 4.1.

在 4.16 版的變更: Support for v2 variant of this format was added.

Go-i18n翻譯是單向的,因此建議使用(最常見的)英語字串指定基本文件。

備註

Weblate supports the go-i18n JSON v1 and v2 variants. Please choose correct file format matching your environment.

也參考

tt:格式/ jsongo-i18n更新 - 目標文件addon-Web2.json.Customize清理翻譯檔

範例檔案

Example file 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": ""
  }
]

Example file 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 設定組態

Typical Weblate 組件組態 for v1

檔案遮罩

langs/*.json

單語的基底語言檔

langs/en.json

新翻譯的模板

Empty

檔案格式

go-i18n v1 JSON file

Typical Weblate 組件組態 for v2

檔案遮罩

langs/*.json

單語的基底語言檔

langs/en.json

新翻譯的模板

Empty

檔案格式

go-i18n v2 JSON file