Select Page

Translate phrases in overridden files in PrestaShop

Ajeet Chauhan
Published: November 11, 2022

In this blog, we will learn how to translate phrases in the override files. Sometimes we need to override the core PrestaShop classes and controllers and need to add some of our own phrases. But when we translate the module, these phrases are not available in the translation list because core files use the new translation system.


$this->errors[] = $this->trans(
    'This voucher does not exist.',

To overcome this issue, we simply need to create the module instance and use the old translation method:


$objModule = Module::getInstanceByName('wktestmodule');
$this->errors[] = $objModule->l('This is custom error message.');
Translation phrase available in the module

That’s all.

Searching for an experienced
Prestashop Company ?
Read More

If any issue or doubt in the above process, please feel free to let us know in the comment section.

I would be happy to help.

Also, you can explore our PrestaShop Development Services and a large range of quality PrestaShop Modules.

For any doubt contact us at [email protected].