Jump to content

Default module translations in PrestaShop 1.6.0.14


HenrikF
 Share

Recommended Posts

Following problem when developing a module: I want to supply some default translations with my module in german. Let's assume the module is named

mypreciousmodule

and it hosts the follwing files:

/modules/mypreciousmodule/translations/de.php
/modules/mypreciousmodule/mypreciousmodule.php
/modules/mypreciousmodule/mypreciousmodule.tpl

The template-file mypreciousmodule.tpl contains something like this:

<p>{l s='Little Test' mod='mypreciousmodule'></p>

The de.php now contains the following lines:

<?php
global $_MODULE;
$_MODULE = array();
$_MODULE['<{mypreciousmodule}prestashop>mypreciousmodule_19a6b28534565bf0000165fee15208a9'] = 'Kleiner Test';

19a6b28534565bf0000165fee15208a9 is the md5 representation of the string »Little Test«; »Kleiner Test« is the german translation.

Problem is: The german translation does not show up; it's still in english.

I've used exactly this in PrestaShop version 1.5.6.x a lot and it worked like a charm. By looking at translation of other standard-PrestaShop modules in the /modules directory it looks likes I did everything fine.

The file system rights of the Linux-system are also set so the webserver and PHP can read the files.

Of course: I can create a translation for the module in the PrestaShop administration using the

 

  • Localization > Translations

 

tool. But that's not what I want (especially when selling »my precious module« ... ;-) ).

One thing bugs me a bit: When looking at the documentation of PrestaShop 1.6 for translating files it says:

This file must not be edited manually! It can only be edited through the PrestaShop translation tool.

Any ideas? Is there a hidden new mechanism in PrestaShop 1.6 which prevents translation of non-default modules?

Kind regards,
Henrik Fisch

Edited by HenrikF (see edit history)

Share this post


Link to post
Share on other sites

Not spotting any issues offhand really, sounds like it should be working.

 

One thing I'd check, have a look in the skins folder, see if there are any language files in the module override section there, might be that it auto generated one for de using all the standard english originals, any language files in the themes folder take precedence afaik, and whenever you change them in the admin, it seems to store them in there, rather than the module folder. That's how it worked last time I had some translations anyhow

Edited by FullCircles (see edit history)

Share this post


Link to post
Share on other sites

Hey FullCircles,

thank you for your reply. I had a look in the themes folder and: Yes,  there were some folders and files! But it turned out it is not the cause of my problem. After deleting all the translations directories in the appropriate module folders of the theme:

/themes/{mytheme}/modules/{mymodules}/translations

nothing has changed. :huh2: (btw.: this emoticon actually shows very accurate my current mood)

I am beginning to suspect, something's wrong with my installation of PrestaShop 1.6.0.14. I am doing a fresh re-install now and will see if something changes. I'm coming back with any - hopefully good - news.

Any other ideas meanwhile?

Kind regards,
Henrik Fisch

Share this post


Link to post
Share on other sites

Got it (thank god)!

 

It was plain dead simple a problem with the Linux rights of the translations directory: I've missed to set the »execute« right of that directory. It was set to:

4 drw-rw-r-- 2 httpd httpd 4096 May 21 15:58 translations

Therefore the user httpd - which is my Apache server - could not change into this directory. In my case - PHP is running as an Apache-module and therefore the Apache server itself is in charge of actions in the file system - it has to be like this:

4 drwxrw-r-- 2 httpd httpd 4096 May 21 15:58 translations

I'm VERY relieved!

 

Thank you FullCircles for your suggestions and taking the time to help me! :)

 

Kind regards,

Henrik Fisch

 

 

P.S.: What do we learn from this? Always and ever keep an eye on EVERY little tiny itchy bitchy error message a system gives you:

 

a - In my case the error message PrestaShop when translating the module in the administration (see my 1st post)

b - the error-logs of the server

Edited by HenrikF (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More