weblate/docs/formats/i18next.rst
Gersona 725bd96349
feat(docs): Automatically generate format features docmentation (#18106)
* initial implementation suggestion

* basic supported features snippets generation

* Add API identifiers, read-only strings and common extensions to features table

* generate doc features snippet files

* autogenerated snippets cleanup

* changelog update

* delete one file to test auto-update

* replace SUPPORTS_FUZZY with file format additional_states flag

* docs: Documentation snippets update

* fix include statetement typo

* fix incorrect monolingual attributes

* minor styling change

* docs: Documentation snippets update

* exclude snippets from being treated as standalone documents

* Set YAMLFormat as both mono/bilingual

* docs: Documentation snippets update

* fix duplicate format IDs

* only use backwards quotes for literals

---------

Co-authored-by: gersona <6675010+gersona@users.noreply.github.com>
Co-authored-by: Michal Čihař <michal@weblate.org>
2026-04-01 15:41:20 +00:00

73 lines
2.3 KiB
ReStructuredText

.. _js-i18next:
.. _i18next:
.. _i18nextv4:
i18next JSON files
------------------
.. index::
pair: i18next; file format
.. versionchanged:: 4.15.1
Support for v4 variant of this format was added.
.. hint::
In case you use plurals, it is recommended to use v4 as that aligned plural
handling with CLDR. Older versions have different plural rules for some
languages which are not correct.
i18next is an internationalization framework written in and for JavaScript.
Weblate supports its localization files with features such as plurals.
i18next translations are monolingual, so it is recommended to specify a base file
with (what is most often the) English strings.
i18next JSON file v4
++++++++++++++++++++
Choose this format if unsure. It stores plurals using standard CLDR suffixes.
i18next JSON file v3
++++++++++++++++++++
Use for legacy projects which are using numeric suffixes for plurals.
.. note::
The v2 and v1 variants are mostly compatible with v3, with exception of how
plurals are handled.
.. seealso::
* :doc:`tt:formats/json`
* https://www.i18next.com/
* `i18next JSON Format <https://www.i18next.com/misc/json-format>`_
* :ref:`updating-target-files`
* :ref:`addon-weblate.json.customize`
* :ref:`addon-weblate.cleanup.generic`
Example file:
.. literalinclude:: ../../weblate/trans/tests/data/en.i18next.json
:language: json
.. include:: /snippets/format-features/i18nextv4-features.rst
.. include:: /snippets/format-features/i18next-features.rst
Weblate configuration
+++++++++++++++++++++
+-------------------------------------------------------------------+
| Typical Weblate :ref:`component` |
+================================+==================================+
| File mask | ``langs/*.json`` |
+--------------------------------+----------------------------------+
| Monolingual base language file | ``langs/en.json`` |
+--------------------------------+----------------------------------+
| Template for new translations | `Empty` |
+--------------------------------+----------------------------------+
| File format | `i18next JSON file v3` |
+--------------------------------+----------------------------------+