New in Symfony 3.3: XLIFF linter
February 24, 2017 • Published by Javier Eguiluz
Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.
In computer programming, a linter is "any tool that flags suspicious usage in
software written in any computer language". In Symfony, linters are commands
that check the validity of several elements. For example, the lint:yaml
command checks that the syntax of the YAML files in your application is correct.
In Symfony 3.3 we added a new linter for XLIFF translation files. It works
the same as lint:yaml
, so you can lint single files, whole directories and
even entire bundles:
1 2 3 4 5 6 7 8 9 10 11
# lint a single file
$ ./bin/console lint:xliff app/Resources/translations/messages.en.xlf
# lint the whole directory
$ ./bin/console lint:xliff app/Resources/translations
# lint a specific bundle
$ ./bin/console lint:xliff @AppBundle
# add '--format=json' option to export the results into JSON format
$ ./bin/console lint:xliff @AppBundle --format=json
Executing linters automatically is a must-have for your Symfony applications, for example during the deployment process or as part of your CI workflow (like we do in the Symfony Demo application.)
Help the Symfony project!
As with any Open-Source project, contributing code or documentation is the most common way to help, but we also have a wide range of sponsoring opportunities.
Comments are closed.
To ensure that comments stay relevant, they are closed for old posts.
Nice addition! What about a separate linter package?
See also: https://github.com/symfony/symfony/issues/18987
👍
If you need a separate package : https://mickaelandrieu.github.io/xml-linter/
Great post Thanks for sharing!