Jump to content

Translating English text to other languages inside module not working / Solved


Recommended Posts

Prestashop 8.2.3
New translation system

I try to translate English text to other languages inside module:

$language = 'pl-PL';
$translation_en_US = 'new element';
$translation_pl_PL = Context::getContext()->getTranslator()->trans($translation_en_US, [], 'Modules.Mymodule.Myfile', $language);

and I always get English version of the text. It does not matter which English text I try to translate, it does not work.

Other automatic translations of the string 'new element' to front side and back office work good.

All other automatic translations of the strings to front side and back office work good.

Possibly I can use a function: getModuleTranslation
from the file: https://github.com/PrestaShop/PrestaShop/blob/8.2.x/classes/Translate.php
but I am not sure how.

I can write my own function to translate, for example like this:
https://github.com/PrestaShop/PrestaShop/issues/13024

How can I solve this problem?

 

 

Edited by Peter_17
Solved (see edit history)
Link to comment
Share on other sites

  • Peter_17 changed the title to Translating English text to other languages inside module not working / Solved

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...