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

88 lines
3.5 KiB
ReStructuredText

.. _csv:
CSV files
---------
.. index::
pair: CSV; file format
pair: Comma separated values; file format
CSV files can contain a simple list of source and translation. Weblate supports
the following files:
* Files with header defining fields (``location``, ``source``, ``target``,
``ID``, ``fuzzy``, ``context``, ``translator_comments``,
``developer_comments``). This is the recommended approach, as it is the least
error prone. Choose :guilabel:`CSV file` as a file format.
* Files with two fields—source and translation (in this order). Choose
:guilabel:`Simple CSV file` as a file format.
* Headerless files with fields in order defined by the `translate-toolkit`_: ``location``, ``source``,
``target``, ``ID``, ``fuzzy``, ``context``, ``translator_comments``, ``developer_comments``.
Choose :guilabel:`CSV file` as a file format.
* Remember to define :ref:`component-template` when your files are monolingual
(see :ref:`bimono`).
.. hint::
By default, the CSV format does autodetection of file encoding. This can be
unreliable in some corner cases and causes performance penalty. Please
choose a file format encoding to avoid this (for example :guilabel:`UTF-8`).
.. warning::
The CSV format currently automatically detects the dialect of the CSV file.
In some cases the automatic detection might fail and you will get mixed
results. This is especially true for CSV files with newlines in the
values. As a workaround it is recommended to omit quoting characters.
.. seealso::
:doc:`tt:formats/csv`
.. _translate-toolkit: https://toolkit.translatehouse.org/
.. _multivalue-csv:
Multivalue CSV file
+++++++++++++++++++
.. versionadded:: 4.13
This variant of the CSV files allows storing multiple translations per string.
Example files
+++++++++++++
Example file:
.. literalinclude:: ../../weblate/trans/tests/data/cs.csv
:language: text
.. include:: /snippets/format-features/csv-features.rst
Weblate configuration
+++++++++++++++++++++
+-------------------------------------------------------------------+
| Typical Weblate :ref:`component` for bilingual CSV |
+================================+==================================+
| File mask | ``locale/*.csv`` |
+--------------------------------+----------------------------------+
| Monolingual base language file | `Empty` |
+--------------------------------+----------------------------------+
| Template for new translations | ``locale/en.csv`` |
+--------------------------------+----------------------------------+
| File format | `CSV file` |
+--------------------------------+----------------------------------+
+-------------------------------------------------------------------+
| Typical Weblate :ref:`component` for monolingual CSV |
+================================+==================================+
| File mask | ``locale/*.csv`` |
+--------------------------------+----------------------------------+
| Monolingual base language file | ``locale/en.csv`` |
+--------------------------------+----------------------------------+
| Template for new translations | ``locale/en.csv`` |
+--------------------------------+----------------------------------+
| File format | `Simple CSV file` |
+--------------------------------+----------------------------------+