As a Magento extension developer sometimes, it seems a hectic task to create the translation file in Magento 1 as we need to create the translation CSV file manually, but in magento2 you can use Magento command-line tool to generate the translation CSV for your module automatically, I am adding this article because many developers still create translation files manually.
Magento 2 allow developer can generate the csv translate file very simple.
Just login to your ssh and redirect to Magento 2 root folder and tyle:
php bin/magento i18n:collect-phrases –output=”/directory-to-generate-out/locale_name.csv” /path-to-your-module-directoy
in the above command :
–output flag is used to show the destination of the CSV file to be generated, and if you do not pass the –output param then the output is generated on the terminal.
and the last param is to tell for which module you want to create the translation CSV .
Hope this can help you .