I've a Magento2 application with A LOT of texts and sometimes I have to add new phrases that need to be translated as well.

To wrap text that needs to be translated I use:

<?php echo __("Lorem ipsum ..")?>

Then I edit the csv file in i18n theme's folder.

In order to add new string to the file, I run magento i18n:collect-phrases, but it overrides the .csv output file in the theme directory, so I lose the old translations.

I think I'm not understanding how to correctly generate and use translation dictionaries, can you pls explain it here?

1 Answer 1


Magento 2 i18n:collect-phrases it will generate translation CSV file from all core CSV text.

If you want to change any core text, you can run :

php bin/magento i18n:collect-phrases

It will collect all translation from the core.

Magento i18n:collect-phrases it will use for only first time for collect core translation. Once complete after you can change the text in your theme but no need to use this command after any modification in theme translation. If you run this after any modification in theme then you lose your previously changes.

Magento i18n:collect-phrases this command use for collect core translation and write it in theme.

  • okay, but what shall I do when I add new text to my theme?
    – davideghz
    Nov 29, 2016 at 17:41
  • Yes you can add your custom text to in your theme. Nov 29, 2016 at 17:42
  • and how can I add new string to csv file?
    – davideghz
    Nov 29, 2016 at 17:45
  • You can manually write text to csv file. Nov 29, 2016 at 17:45
  • It doesn't look like the right way to do it. o,O
    – davideghz
    Nov 30, 2016 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.