Skip to main content

Symfony Translation Command

Installation

To install the Symfony Translation Command, run the following command:

composer require symfony/translation

Configuration

# config/packages/translation.yaml
framework:
default_locale: 'en'
translator:
default_path: '%kernel.project_dir%/translations'

Extracting Translation Messages

To show all available translation messages, run the following command:

# Eg. for English
symfony console translation:extract --dump-messages en

To force the extraction of translation messages, run the following command:

# Eg. for English
symfony console translation:extract --force en

To get help on the command, run the following command:

symfony console translation:extract --help