sari Posted December 17, 2014 Share Posted December 17, 2014 (edited) Hi, I'm developing a basic module, and trying out the translations thing.What I don't understand is that Only on translatable field is being shown in the modules translations page. I have this basic module: <?php if (!defined('_PS_VERSION_')) { exit; } class Warranty extends Module { public function __construct() { $this->bootstrap = true; $this->name = "warranty"; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'XXX'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.5'); parent::__construct(); $this->displayName = $this->l("Warranty Registration"); $this->description = $this->l("Allow your customers to register their warranty."); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); } public function install() { if (!parent::install()) { return false; } return true; } public function uninstall() { if (!parent::uninstall()) { return false; } return true; } } ?> And a ModuleFrontController the uses this for the translatable strings: $this->module->l("Please fill all rquired fields"); The only thing I see under "warranty" in the translations page is "Are you sure you want to uninstall?".What am I doing wrong? Edited December 17, 2014 by sari (see edit history) Link to comment Share on other sites More sharing options...
bellini13 Posted December 17, 2014 Share Posted December 17, 2014 have you tried this instead? $this->module->l('Please fill all rquired fields', 'name of controller'); Two things 1) use single quotes instead of double quotes 2) add the name of your controller as a second parameter. So if the name of the modules controller is WarrantyValidationModuleFrontController, then use 'validation' as the second parameter. 1 Link to comment Share on other sites More sharing options...
sari Posted December 17, 2014 Author Share Posted December 17, 2014 Thanks, the single quote fixed it.But I see that: $this->module->l works even without the controller name, it shows under the controller section in the Translation page, whats the purpose for the controller name? Link to comment Share on other sites More sharing options...
bellini13 Posted December 17, 2014 Share Posted December 17, 2014 I believe it helps with caching Link to comment Share on other sites More sharing options...
vekia Posted December 18, 2014 Share Posted December 18, 2014 why not just to use $this->l('') ?it's first time when i see $this->module->l(''): Link to comment Share on other sites More sharing options...
bellini13 Posted December 18, 2014 Share Posted December 18, 2014 you need to use $this->module->l() if you are doing this from a module controller. The ModuleFrontController, FrontController, and Controller classes do not have a function named l. So you cannot do $this->l() as it would result in a function does not exist error 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