14
php bin\magento i18n:collect-phrases -o "C:\xampp\htdocs\magento\app\design\i18n\xx_YY.csv" -m 

collects all phrases in the magento application and outputs a csv file with 4 columns:

enter image description here

php bin\magento i18n:collect-phrases -o "C:\xampp\htdocs\magento\app\design\i18n\xx_YY2.csv" C:\xampp\htdocs\magento\app\design\frontend

collects all phrases in app\design\frontend and outputs a csv file with 2 columns:

enter image description here

What is the difference in the two files ?

Also I'm currently using de_DE.csv from https://github.com/splendidinternet/Magento2_German_LocalePack_de_DE which (i think) translates the whole magento application. Why does this file have 2 columns instead of 4 (like the xx_YY.csv I created) ?

Also, when I install a new theme , can I just collect all phrases from that theme into a csv file (2 columns) -> then copy and paste it's content into the end of the file de_DE.csv and everything will work ?

3 Answers 3

6

The CSV with 4 columns is the global CSV for all modules. That's why it contains 3rd column as module and 4th column as Module_Name.This file should be placed in i18n folder parallel to app.

The CSV with 2 columns is the CSV required for each module. That's why module name is not specified in it. This file is located under i18n folder of each module.

2

The csv with 4 columns is used to create language package with composer.

In official doc http://devdocs.magento.com/guides/v2.1/config-guide/cli/config-cli-subcommands-i18n.html#config-cli-subcommands-xlate-dict :

-m | --magento Required to create a language package from this translation dictionary. If used, searches the directories that contain bin/magento. This option adds themes or modules to each line in the dictionary.

2

You will get all the text with module and theme name with this command :

bin/magento i18n:collect-phrases --output="<csv file path and name>" --magento

In this first you have to create a csv file on any path of your magento directory and set full path (absolute path) of your file here "". It will export all the text with module/theme name.

1
  • In Phrase.php line 90: Missed phrase Commented Mar 23, 2020 at 7:00

Your Answer

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

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