Skip to content

Added a new article about linting translation files #7801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2017
Merged
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
31 changes: 31 additions & 0 deletions translation/lint.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. index::
single: Translation; Lint
single: Translation; Translation File Errors

How to Find Errors in Translation Files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"How to Find Errors in Yaml Translation Files"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but in the 3.2 and master versions of this article (which is already merged) we explain yaml and xliff. Besides, in the future we could explain more formats, so I think we should maintain the generic title.

=======================================

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 translation file
using the ``lint:yaml`` command:

.. code-block:: terminal

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

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

# lint a specific bundle
$ ./bin/console lint:yaml @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