Edge_jr Posted February 25, 2017 Share Posted February 25, 2017 Hi, I want to translate my module. So I have imported language pack and did back office translation for my module from Localization =>Translation menu options. This generated admin.php,fields.php,errors.php,tabs.php in Translation folder. I want to add de.php,fr.php in my module translation folder. So that my module will have french,german etc translation files in module zip file. I see in other module , it has below style code but I could not find it in above php files in translation folder. I have replaced mymodule with mymodule name and other but it is not working. <?php global $_MODULE; $_MODULE = array(); $_MODULE['<{mymodule}prestashop>mymodule_2ddddc2a736e4128ce1cdfd22b041e7f'] = 'Mon module'; $_MODULE['<{mymodule}prestashop>mymodule_d6968577f69f08c93c209bd8b6b3d4d5'] = 'Description du module.'; $_MODULE['<{mymodule}prestashop>mymodule_533937acf0e84c92e787614bbb16a7a0'] = 'Êtes-vous certain de vouloir désinstaller ce module ? Vous perdrez tous vos réglages !'; $_MODULE['<{mymodule}prestashop>mymodule_0f40e8817b005044250943f57a21c5e7'] = 'Aucun nom fourni'; $_MODULE['<{mymodule}prestashop>mymodule_fe5d926454b6a8144efce13a44d019ba'] = 'Valeur de configuration non valide.'; $_MODULE['<{mymodule}prestashop>mymodule_c888438d14855d7d96a2724ee9c306bd'] = 'Réglages mis à jour'; $_MODULE['<{mymodule}prestashop>mymodule_f4f70727dc34561dfde1a3c529b6205c'] = 'Réglages'; $_MODULE['<{mymodule}prestashop>mymodule_2f6e771db304264c8104cb7534bb80cd'] = 'Valeur de configuration'; $_MODULE['<{mymodule}prestashop>mymodule_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; return $_MODULE; Any idea? -Thanks Link to comment Share on other sites More sharing options...
Edge_jr Posted February 26, 2017 Author Share Posted February 26, 2017 (edited) Hi, I have gone through this link. I am not getting file in translation folder with module string as per documentation.I check in root/translation/ admin.php,errors.php,fields.php,tab.php etc There is no file getting generated in module fr.php or de.php automatically. any idea? -Thanks Edited February 26, 2017 by edge82 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted February 27, 2017 Share Posted February 27, 2017 Did you choose "Core (no theme selected)" when you made the translations? If you chose "default-bootstrap", then the translations will be inside the theme instead of the root. Link to comment Share on other sites More sharing options...
Edge_jr Posted March 1, 2017 Author Share Posted March 1, 2017 (edited) HI, I have selected option "installed module translation" , it creates files inside default-bootstrap folder module translation.I took this folder and put inside my module and created zip file , install on new instance. When I change the language on new instance, my module back-offfice translation not working. I do copy files inside default-bootstrap on new instance.When I select core no theme with install module translation, it writes inside mymodule translation folder.But still on change on default language to french , it is not taking back-office translation for the module. Any idea? -Thanks Edited March 1, 2017 by edge82 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted March 2, 2017 Share Posted March 2, 2017 That explains why it isn't working. You can't simply copy the translations from the theme to your module, since the files are different than when they are saved directly to the module. You should save your translations using the "Core (no theme selected)" option. If you can't do that, you'll need to edit the translation files and change every instance of default-bootstrap to prestashop Link to comment Share on other sites More sharing options...
Edge_jr Posted March 2, 2017 Author Share Posted March 2, 2017 (edited) Hi, Thanks I got some part of module translation using installed module and core ( no theme selected) options.The problem I am facing is back-office fields not showing in above option, they come with back-office translation. It saves in translation admin.php file instead mymodule/translation/fr.php How to get translated fields label from admin.php from root/translation/ inside mymodule translation folder. Because I want to zip mymodule, so that back-office and installed module with core option should come in zip file. Any idea? -Thanks Edited March 3, 2017 by edge82 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted March 4, 2017 Share Posted March 4, 2017 I think it's not possible to include Back Office translations in a module. You'll need to add mod="mymodule" to the strings and translate them through the "Installed module translations" instead of the "Back Office translations". Link to comment Share on other sites More sharing options...
Edge_jr Posted March 8, 2017 Author Share Posted March 8, 2017 (edited) Hi, May I get the documentation or little guide how to do it. What to do in Admin Controller of my module, so that it will be translated from installed module translation.For example below text field 'input' => array ( array( 'type' => 'text', 'label' => $this->l('Title:'), 'name' => 'my_title', 'lang' => false, 'size' => 33, 'hint' => $this->l('Invalid characters:') . ' 0-9!<>,;?=+()@#"�{}_$%:', 'required' => true, 'desc' => $this->l('The title of the block.') ), Any idea? -Thanks Edited March 8, 2017 by edge82 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted March 9, 2017 Share Posted March 9, 2017 You're already doing it the right way. You should see translations for your admin controller in "Installed module translations" under your module's name. It works with my module. Link to comment Share on other sites More sharing options...
Edge_jr Posted March 9, 2017 Author Share Posted March 9, 2017 (edited) Hi, The translation for back-office coming in ADMINMYMODULE . This fields are not showing using installed module translation with core theme option.These fields are inside function renderForm() and showing using back-office translation option.Any idea? -Thanks Edited March 9, 2017 by edge82 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted March 10, 2017 Share Posted March 10, 2017 I have no idea why it wouldn't be working. I have no problems translating the admin controllers in my Image/Video Gallery module. Here's what I see: You could try using $this->module->l instead of $this->l but you shouldn't need to do that. 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