umamishop Posted June 28, 2011 Share Posted June 28, 2011 Hi,I'm trying to translate my site, and need to change some front-office text located in a .php file. I know in a .tpl file, you use {l s='Your text' mod='yourmodulename'} and then do the translation in Tools > Translations > Module translations.What about for .php files? How can I translate the text for these files? {l s='Your text' mod='yourmodulename'} and $this->l('Your text') don't seem to work.Thank you. Link to comment Share on other sites More sharing options...
umamishop Posted July 10, 2011 Author Share Posted July 10, 2011 Can someone help with this question? Thanks! Link to comment Share on other sites More sharing options...
ahmeda Posted February 28, 2012 Share Posted February 28, 2012 I have the same issue too Link to comment Share on other sites More sharing options...
ahmeda Posted February 28, 2012 Share Posted February 28, 2012 You can add this line of code: if(!$dontTranslate) { $this->displayName = $this->l('My module'); $this->description = $this->l('Description of my module.'); } This will let the dispaly namd and description appear on the Tools > Translations > Module translations screen. But what if we want to translate a text outside the constructor, is there a way? Link to comment Share on other sites More sharing options...
matin_gh Posted September 15, 2015 Share Posted September 15, 2015 (edited) Hi, I'm trying to translate my site, and need to change some front-office text located in a .php file. I know in a .tpl file, you use {l s='Your text' mod='yourmodulename'} and then do the translation in Tools > Translations > Module translations. What about for .php files? How can I translate the text for these files? {l s='Your text' mod='yourmodulename'} and $this->l('Your text') don't seem to work. Thank you. Hi, Try this $this->l('My string', 'filename') For instance, in the /bankwire/controllers/front/validation.php file: die($this->module->l('This payment method is not available.', 'validation')); http://doc.prestashop.com/display/PS16/Module+translation Edited September 15, 2015 by matin_gh (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now