Jump to content

Translation for addon


Recommended Posts

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

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 by edge82 (see edit history)
Link to comment
Share on other sites

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 by edge82 (see edit history)
Link to comment
Share on other sites

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

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 by edge82 (see edit history)
Link to comment
Share on other sites

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

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 by edge82 (see edit history)
Link to comment
Share on other sites

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 by edge82 (see edit history)
Link to comment
Share on other sites

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:

post-13933-0-08801100-1489104487_thumb.jpg

 

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

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