Jump to content

How to translate twig to be compatible with 1.7.x


Recommended Posts

How to translate twig variables, ideally to be compatible with all 1.7 verisons of prestashop?

Only thing that works is $this->l() in mymodule.php

My twig:

{{ 'test3'|trans({}, 'Modules.Mymodule.Admin') }}

My php:

$this->displayName = $this->trans('text', [], 'Modules.Mymodule.Admin');


Module name is mymodule. I even removed the underscore from name, becouse I found it can be problem, it does look ugly and still don't work. What is the correct way? I copied the code from another PrestaShop modules and it seems to work fine there. But I do not see options to translate my module from backend, only the few I used $this->l at.

Share this post

Link to post
Share on other sites

1 minute ago, ComGrafPL said:

If you don't have it in translations. Check any tpl and change it directly.

I'm not sure I understand. I'm using the twig templating engine, not tpl. I want to translate text in this files (*.html.twig) to be compatible with PrestaShop 1.7.x. 

Share this post

Link to post
Share on other sites

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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More