Fichiers JSON

Modifié dans la version 4.3: The structure of JSON file is properly preserved even for complex situations which were broken in prior releases.

JSON format is used mostly for translating applications implemented in JavaScript.

Weblate currently supports several variants of JSON translations:

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

Indication

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

Fichiers d’exemples

Fichier d’exemples :

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

Les fichiers imbriqués sont aussi pris en charge (voir les prérequis ci-dessus), un tel fichier pourrait ressembler à :

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

Configuration Weblate

Configuration des composants typique de Weblate

Masque de fichier

langs/translation-*.json

Fichier de langue de base mono-langue

langs/translation-en.json

Modèle pour les nouvelles traductions

Vide

Format de fichier

fichier JSON à structure imbriquée