Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version
WARNING: You are browsing the documentation for Symfony 4.0 which is not maintained anymore. Consider upgrading your projects to Symfony 5.1.

How to Find Errors in Translation Files

4.0 version

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:

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

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

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

$ ./bin/console lint:yaml translations/ --format=json
$ ./bin/console lint:xliff translations/ --format=json

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.