New in Symfony 3.3: XLIFF linter

Warning: This post is about an unsupported Symfony version. Some of this information may be out of date. Read the most recent Symfony Docs.

Contributed by
Javier Eguiluz
in #21578.

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:

# 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.


Nice addition! What about a separate linter package?

See also:
If you need a separate package :
Great post Thanks for sharing!

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.