From a5e1a3edbbdca33a21bca83fae89d13de538bb75 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 13 Mar 2017 13:21:03 +0100 Subject: [PATCH 1/2] Added a new short article about linting translation files --- translation/lint.rst | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 translation/lint.rst diff --git a/translation/lint.rst b/translation/lint.rst new file mode 100644 index 00000000000..37b90a9d468 --- /dev/null +++ b/translation/lint.rst @@ -0,0 +1,35 @@ +.. index:: + single: Translation; Lint + single: Translation; Erroneous Messages + +How to Find Errors in Translation Messages +========================================== + +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 From c7e00d72ed761b12ba6ba0637d65f70398095b45 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 13 Mar 2017 13:22:35 +0100 Subject: [PATCH 2/2] Minor fixes --- translation/lint.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translation/lint.rst b/translation/lint.rst index 37b90a9d468..0c64e4a427e 100644 --- a/translation/lint.rst +++ b/translation/lint.rst @@ -1,9 +1,9 @@ .. index:: single: Translation; Lint - single: Translation; Erroneous Messages + single: Translation; Translation File Errors -How to Find Errors in Translation Messages -========================================== +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