Jump to content

[Solved] Module and Languages, How does it work?


Recommended Posts

Hi all,

I created a new module but i am stuck with the language section. How do you create your own words or translation. I don't want to create a new language Pack.
is there anyone who could explain me the following (How does it works):

for instance, i ve got this file in fr.php with

$_MODULE['<{blockcms}prestashop>blockcms_cd275312651aebf8cbbb8d3bb1c086ae'] = 'Bloc CMS';

I understood that the "$_MODULE['<{blockcms}prestashop>blockcms_" points to the 'blockcms' module, but where the 'cd275312651aebf8cbbb8d3bb1c086ae' is it coming from? i think that number is unique and related to: 'Bloc CMS'

but How do you generate that number?

Link to comment
Share on other sites

You can do the translation in Back Office >>Tools>> Translations, select Module translation & click fr lang flag.
Then go to your module to be translated.After translation & press update button in bottom.
On update press, will write to fr.php in the module directory

Link to comment
Share on other sites

Thank you jeevanoss.
i now understood the process. but How do I create my own lines or add a new translation? should i just create a random number form " $_MODULE[’<{blockcms}prestashop>blockcms_cd275312651aebf8cbbb8d3bb1c086ae’] " and then the system will added it up automatically?

Link to comment
Share on other sites

Use the following in PHP files:

$this->l('Your text')



and the following in TPL files:

{l s='Your text' mod='yourmodulename'}



You can then go to Tools > Translations > Module translations, then the new strings should appear in your module's section. You can then enter translations for the string. You shouldn't manually edit the language files, since that is error-prone.

Link to comment
Share on other sites

well thanks you all the users by providing the nice information regarding to the language tools because i was also never know that how to use these language packs through this forum and i also want to apply it on my own website which i have made and i hope now i will be successes in this way thanks for sharing the post with us

Link to comment
Share on other sites

Hi,

if you want to know how that number is translated, it's based on the md5 sum of the english [removed]which is in the tpl or/and php files, when you use what rocky said.

be careful, problem may happen if you use double-quotes instead of simple quotes

Link to comment
Share on other sites

  • 1 month later...
  • 11 months later...

Use the following in PHP files:

 

$this->l('Your text')

 

and the following in TPL files:

 

{l s='Your text' mod='yourmodulename'}

 

You can then go to Tools > Translations > Module translations, then the new strings should appear in your module's section. You can then enter translations for the string. You shouldn't manually edit the language files, since that is error-prone.

 

Hi Rocky!!!

 

Your solution looks great but i can't totally understand where to update php files?? I have made custom footer in my site and used English names of them. But they are not translated by other languages. Please elaborates the steps

 

Thanks in advance

Link to comment
Share on other sites

  • 2 years later...

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