Skip to content

Commit 6a405f4

Browse files
committed
feature #7618 Added a new short article about linting translation files (javiereguiluz)
This PR was squashed before being merged into the master branch (closes #7618). Discussion ---------- Added a new short article about linting translation files This fixes #7536. Commits ------- df7841b Added a new short article about linting translation files
2 parents e3da7aa + df7841b commit 6a405f4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

translation/lint.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.. index::
2+
single: Translation; Lint
3+
single: Translation; Translation File Errors
4+
5+
How to Find Errors in Translation Files
6+
=======================================
7+
8+
Symfony processes all the application translation files as part of the process
9+
that compiles the application code before executing it. If there's an error in
10+
any translation file, you'll see an error message explaining the problem.
11+
12+
If you prefer, you can also validate the contents of any YAML and XLIFF
13+
translation file using the ``lint:yaml`` and ``lint:xliff`` commands:
14+
15+
.. code-block:: terminal
16+
17+
# lint a single file
18+
$ ./bin/console lint:yaml app/Resources/translations/messages.en.yml
19+
$ ./bin/console lint:xliff app/Resources/translations/messages.en.xlf
20+
21+
# lint a whole directory
22+
$ ./bin/console lint:yaml app/Resources/translations
23+
$ ./bin/console lint:xliff app/Resources/translations
24+
25+
# lint a specific bundle
26+
$ ./bin/console lint:yaml @AppBundle
27+
$ ./bin/console lint:xliff @AppBundle
28+
29+
The linter results can be exported to JSON using the ``--format`` option:
30+
31+
.. code-block:: terminal
32+
33+
# lint a single file
34+
$ ./bin/console lint:yaml app/Resources/translations --format=json
35+
$ ./bin/console lint:xliff app/Resources/translations --format=json

0 commit comments

Comments
 (0)