So here’s a nice little one-liner you can use to find strings that require translation in your Magento projects. Just go to the folder of your theme or extension and execute the following command:
1 |
find . -type f | xargs cat | grep -o "__('.*')" | uniq | sed -e "s/__('\(.*\)')/\"\1\",\"\1\"/" |
What it does, it looks for occurances of __(‘ anything ‘) in your code and creates a typical Magento CSV-translation string of it.
The output will be a copy/paste-able chunk of CSV data you can use as a boilerplate for your CSV-files:
1 2 3 4 5 6 7 8 9 10 |
"Installed!","Installed!" "Not Installed","Not Installed" "Sort by date has been removed as listing option","Sort by date has been removed as listing option" "Sort by date has been added to the listing options","Sort by date has been added to the listing options" "Default","Default" "Newest First","Newest First" "Reset Product positions","Reset Product positions" "Yes","Yes" "g","g" " kg"," kg" |
… depending on what’s in your code of course …
Visitors give this article an average rating of 4.0 out of 5.
How would you rate this article?
★ ★ ★ ★ ★