Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions translation/lint.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.. index::
single: Translation; Lint
single: Translation; Translation File Errors

How to Find Errors in Translation Files
=======================================

Symfony processes all the application translation files as part of the process
that compiles the application code before executing it. If there's an error in
any translation file, you'll see an error message explaining the problem.

If you prefer, you can also validate the contents of any YAML and XLIFF
translation file using the ``lint:yaml`` and ``lint:xliff`` commands:

.. code-block:: terminal

# lint a single file
$ ./bin/console lint:yaml app/Resources/translations/messages.en.yml
$ ./bin/console lint:xliff app/Resources/translations/messages.en.xlf

# lint a whole directory
$ ./bin/console lint:yaml app/Resources/translations
$ ./bin/console lint:xliff app/Resources/translations

# lint a specific bundle
$ ./bin/console lint:yaml @AppBundle
$ ./bin/console lint:xliff @AppBundle

The linter results can be exported to JSON using the ``--format`` option:

.. code-block:: terminal

# lint a single file
$ ./bin/console lint:yaml app/Resources/translations --format=json
$ ./bin/console lint:xliff app/Resources/translations --format=json