JSON 檔案

在 4.3 版的變更: 即使對於在之前發佈版本中中斷的複雜情況,JSON 文件的結構也適當保留。

JSON 格式主要用於翻譯 Javascript 中實施的應用。

Weblate 目前支援 JSON 翻譯的幾個變體:

JSON 翻譯通常是單語言的,因此推薦指定帶有(最經常使用的)英語字串的翻譯範本文件。

提示

JSON fileJSON nested structure file 都可以處理相同類型的文件。翻譯時都保留現有的 JSON 架構。

The only difference between them is when adding new strings using Weblate. The nested structure format parses the newly added key and inserts the new string into the matching structure. For example app.name key is inserted as:

{
   "app": {
      "name": "Weblate"
   }
}

範例檔案

範例檔案:

{
  "Hello, world!\n": "Ahoj světe!\n",
  "Orangutan has %d banana.\n": "",
  "Try Weblate at https://demo.weblate.org/!\n": "",
  "Thank you for using Weblate.": ""
}

也支援巢狀文件(要求請參閱上面),這樣的文件看起來像:

{
  "weblate": {
    "hello": "Ahoj světe!\n",
    "orangutan": "",
    "try": "",
    "thanks": ""
  }
}
支持的功能

副檔名

.json

Linguality

單語和雙語

Supports plural

No

支援描述

No

支援解釋

No

Supports context

No

Supports location

No

Supports flags

No

API 識別碼

json, json-nested

支援唯讀字串

No

Weblate 配置

典型的 Weblate 組件配置

檔案遮罩

langs/translation-*.json

單語的基底語言檔案

langs/translation-en.json

新翻譯的範本

空白

檔案格式

JSON nested structure file

檔案格式參數

檔案格式參數 with the pattern json_* can be used to configure the behavior of the JSON format.