JSON datoteke

Promijenjeno u verziji 4.3: The structure of JSON file is properly preserved even for complex situations which were broken in prior releases.

JSON format se uglavnom koristi za prevođenje aplikacija implementiranih u JavaScriptu.

Weblate trenutačno podržava nekoliko varijanti JSON prijevoda:

JSON translations are usually monolingual, so it is recommended to specify a base file with (what is most often the) English strings.

Savjet

The JSON file and JSON nested structure file can both handle same type of files. Both preserve existing JSON structure when translating.

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"
   }
}

Example files

Example file:

{
  "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.": ""
}

Nested files are supported as well (see above for requirements), such a file can look like:

{
  "weblate": {
    "hello": "Ahoj světe!\n",
    "orangutan": "",
    "try": "",
    "thanks": ""
  }
}
Podržane funkcije

Datotečni sufiks

.json

Jezičnost ⓘ

Jednojezične i dvojezične

Podržava množinu ⓘ

No

Podržava opise ⓘ

No

Podržava objašnjenja ⓘ

No

Podržava kontekst ⓘ

No

Podržava mjesto ⓘ

No

Podržava oznake ⓘ

No

Identifikator API-ja

json, json-nested

Podržava izraze koji su samo-za-čitanje ⓘ

No

Supports removing obsolete strings ⓘ

No

Weblate konfiguracija

Typical Weblate Konfiguracija komponente

Maska datoteke

langs/translation-*.json

Jednojezična datoteka osnovnog jezika

langs/translation-en.json

Predložak za nove prijevode

Empty

Format datoteke

JSON nested structure file

Parametri formata datoteke

Parametri formata datoteke with the pattern json_* can be used to configure the behavior of the JSON format.