I met a problem that how to translate the module's phrase into other languages(eg. Japanese).
For example, some code may like this:
app/code/My_vendor/My_module/Controller/i18n/jp_JP.csv
"test","Japanese character"
app/code/My_vendor/My_module/Controller/index.php
......
$form = '<h3>test</h3>';
$this->getResponse()->setBody($form);
......
If STORES->Configuration->Locale
Options is selected with English(United States), it will show "test" to users; if Japanese(Japan) is selected, it will show "Japanese character".
I had seen the tutorial
http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/translations/xlate.html
but I'm not sure what should I do next.
Best Answer
2 points: You placed translate file into wrong place. The correct path should be
app/code/<My_vendor>/<My_module>/i18n/jp_JP.csv
.And you didn't use
__('text to translate')
to parse the text to translate in template file.So in your case, change
$form = '<h3>test</h3>';
to$form = '<h3>' . __('test') . '</h3>';