Skip to content

Commit

Permalink
Docs: Document JSON format changes
Browse files Browse the repository at this point in the history
There won't be single format in the end as they differ at time when
creating new unit. This is now properly documented and changes from
previous situation is covered by the docs as well.

Fixes #2149
  • Loading branch information
nijel committed Sep 21, 2020
1 parent f028262 commit 21b25c6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions docs/formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,11 @@ JSON files
Since Weblate 2.16 and with translate-toolkit at-least 2.2.4, nested
structure JSON files are supported as well.

.. versionchanged:: 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.

Expand All @@ -771,13 +776,12 @@ Nested files are supported as well (see above for requirements), such a file can
.. literalinclude:: ../weblate/trans/tests/data/cs-nested.json
:language: json

.. warning::

Weblate currently handles nested JSON by flattening the keys. This leads to
serializing issues when special chars such as ``.`` or ``[]`` are used in
the actual keys, because Weblate thinks it is indication of nesting.
.. hint::

See <https://github.com/WeblateOrg/weblate/issues/2149>
The :guilabel:`JSON file` and :guilabel:`JSON nested structure file` can
both handle same type of files. The only difference between them is when
adding new strings. The nested variant tries to parse the key and insert the
new string into the matching structure.

+-------------------------------------------------------------------+
| Typical Weblate :ref:`component` |
Expand Down

0 comments on commit 21b25c6

Please sign in to comment.