Jump to content

Change language context for Smarty templates


Recommended Posts

How chnage language context for Smarty, that all strings in tpl {l s='...' mod='...'} uses spesified language, instead of Employee default language.

Ex., I tried in module before $this->display() or $this->context->smarty->fetch()  change context:

$this->context->language = new Language(5);
$this->context->employee->id_lang = 5;

Does not help, UI language has changed, but render of .tpl  still uses employee default language.

Link to comment
Share on other sites

Issue  were in deeper...

Prestashop at the first mention of any {l s='..'}  or $this->l(...) loads language file and cached it in global $_MODULES varaible, and after not load another language and not replaced loaded strings, even if change language context during runtime.

I solved this so, need finding the place in the module where the translation has never been requested before and changing the language in the context before this place.

Link to comment
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...