I met a problem that how to translate the module's phrase into other languages(eg. Japanese).

For example, some code may like this:


"test","Japanese character"


$form = '<h3>test</h3>';

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.


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>';


Translation file path should be


You should write a translate text code in your controller


like below

$form = '<h3>' . __('test') . '</h3>';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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