weblate/docs/formats/go-i18n.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

75 lines
2.6 KiB
ReStructuredText

.. _go-i18n-json:
go-i18n JSON files
------------------
.. index::
pair: go-i18n; file format
.. versionadded:: 4.1
.. versionchanged:: 4.16
Support for v2 variant of this format was added.
go-i18n translations are monolingual, so it is recommended to specify a base file
with (what is most often the) English strings.
.. note::
Weblate supports the go-i18n JSON v1 and v2 variants. Please choose correct file format
matching your environment.
.. seealso::
* :doc:`tt:formats/json`
* `go-i18n <https://github.com/nicksnyder/go-i18n>`_
* :ref:`updating-target-files`
* :ref:`addon-weblate.json.customize`
* :ref:`addon-weblate.cleanup.generic`
Example files
+++++++++++++
Example file v1:
.. literalinclude:: ../../weblate/trans/tests/data/cs-go18n-v1.json
:language: json
Example file v2:
.. literalinclude:: ../../weblate/trans/tests/data/cs-go18n-v2.json
:language: json
.. include:: /snippets/format-features/go-i18n-toml-features.rst
.. include:: /snippets/format-features/go-i18n-json-features.rst
Weblate configuration
+++++++++++++++++++++
+-------------------------------------------------------------------+
| Typical Weblate :ref:`component` for v1 |
+================================+==================================+
| File mask | ``langs/*.json`` |
+--------------------------------+----------------------------------+
| Monolingual base language file | ``langs/en.json`` |
+--------------------------------+----------------------------------+
| Template for new translations | `Empty` |
+--------------------------------+----------------------------------+
| File format | `go-i18n v1 JSON file` |
+--------------------------------+----------------------------------+
+-------------------------------------------------------------------+
| Typical Weblate :ref:`component` for v2 |
+================================+==================================+
| File mask | ``langs/*.json`` |
+--------------------------------+----------------------------------+
| Monolingual base language file | ``langs/en.json`` |
+--------------------------------+----------------------------------+
| Template for new translations | `Empty` |
+--------------------------------+----------------------------------+
| File format | `go-i18n v2 JSON file` |
+--------------------------------+----------------------------------+