JSON-Dateien#
Geändert in 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 unterstützt derzeit mehrere Varianten von JSON-Übersetzungen:
Simple key / value files, used for example by vue-i18n or react-intl.
Files with nested keys.
JSON-Übersetzungen sind normalerweise einsprachig, daher ist es empfehlenswert, eine Basisdatei mit (meist) englischen Zeichenketten anzugeben.
Hinweis
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"
}
}
Siehe auch
JSON, Aktualisieren der Zielsprachdateien, Ausgabe von JSON anpassen, Übersetzungsdateien bereinigen,
Beispieldateien#
Beispieldatei:
{
"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": ""
}
}
Weblate-Konfiguration#
Typical Weblate Komponentenkonfiguration |
|
---|---|
Dateimaske |
|
Einsprachige Basissprachdatei |
|
Vorlage für neue Übersetzungen |
Leer |
Dateiformat |
JSON-Nested-Structure-Datei |