Jump to content

Module translation prestashop 1.7


Recommended Posts

I can't translate my module with 1.7.0.1 and 1.7.0.2

 

Originally my module works with 1.6 version.

 

I've try this 2 new methods :

 

BO :

$this->trans('string', array(), 'Modules.mymodulename.Admin');

 

FO:

l(s='' d='Modules.mymodulename.Shop')

 

The translationn tool doens't recognize any strings

 

I've try with $this->getTranslator->trans(....

I've also try several cases for my module name.

 

No success.

 

What am I missing ? Do i have to call something specific to translate, i don't find anything in other prestashop native modules...

 

 

 

Link to comment
Share on other sites

It's strange !
 

In the module I'm looking for (EmailSubscription), they are using the new system : {l s='Newsletter' d='Modules.EmailSubscription.Shop'} with domains instead of mod, and you have the translations in the BO ...

The new system should works for new translations exept if we have to declare them somewhere else but I can't find any documentation on this ...

Link to comment
Share on other sites

Nothing strange. New Prestashop modules are written in the new way. But we just don't have the tool to translate. 

 

Check the emailsubscription translation : it found 0 entries to translate :

 

 

http://YOURWEBSITE/YOURADMINDIRECTORY/index.php?tab=AdminTranslations&token=8bb9c80abce4428daf9d5c176fa8f580&type=modules&module=ps_emailsubscription&lang=fr#

Link to comment
Share on other sites

Yes but if you take the classic theme for this module you have the tpl file overrided and you have {l s='Get our latest news and special sales' d='Shop.Theme'} for the title translation which can be found in the translation tool under shop > theme (if you choose the classic theme). So I think that the translation system is working for theme translation but I'm not able to add a new translation ...

Link to comment
Share on other sites

Yes we can access new Translation tool for everything but not module installed.

 

I don't think it's a good idea to target 'Shop.Theme' instead of your module name as written in documentation :).

 

Anyway if you check the AdminTranslator controller l 1285

    /**
     * Get all translations informations for all type of translations
     *
     * array(
     *  'type' => array(
     *      'name' => string : title for the translation type,
     *      'var' => string : name of var for the translation file,
     *      'dir' => string : dir of translation file
     *      'file' => string : file name of translation file
     *  )
     * )
     */
    public function getTranslationsInformations()
    {
        $this->translations_informations = array(
            'back' => array(
                'name' => $this->trans('Back office translations', array(), 'Admin.International.Feature'),
                'var' => '_LANGADM',
                'dir' => _PS_TRANSLATIONS_DIR_.$this->lang_selected->iso_code.'/',
                'file' => 'admin.php',
                'sf_controller' => true,
                'choice_theme' => false,
            ),
            'themes' => array(
                'name' => $this->trans('Themes translations', array(), 'Admin.International.Feature'),
                'var' => '_THEMES',
                'dir' => '',
                'file' => '',
                'sf_controller' => true,
                'choice_theme' => true,
            ),
            'mails' => array(
                'name' => $this->trans('Email translations', array(), 'Admin.International.Feature'),
                'var' => '_LANGMAIL',
                'dir' => _PS_MAIL_DIR_.$this->lang_selected->iso_code.'/',
                'file' => 'lang.php',
                'sf_controller' => false,
                'choice_theme' => false,
            ),
            'others' => array(
                'name' => $this->trans('Other translations', array(), 'Admin.International.Feature'),
                'var' => '_OTHERS',
                'dir' => '',
                'file' => '',
                'sf_controller' => true,
                'choice_theme' => false,
            ),
            'modules' => array(
                'dir' => _PS_MODULE_DIR_,
                'file' => '',
            )
        );

No name, no var for Modules...It seems volontary to not be displayed :'(

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Exactly same problem here. I just upgraded to prestashop 1.7.0.4 because of this release note:

 

  • 7193 Fix modules translation form

 

Well, now I can see the translation item in the dropdown... but ps_categoryproducts still shows 0 items to translate, while there are at least 2:

{l s='%s other product in the same category:' sprintf=[$products|@count] mod='ps_categoryproducts'}
{l s='%s other products in the same category:' sprintf=[$products|@count] mod='ps_categoryproducts'}

I can see strings from other modules, I think it is something related to this module or to old .tpl files, although I changed the tpl several times to different formats.

 

 

Link to comment
Share on other sites

I see this:

 

Update - January 2017

We’ve been too optimistic when we said the new translation system would be available for contributors’ modules built specifically for PrestaShop 1.7.
This is not working. I repeat, this is not working. You should keep using the legacy translation system and it will work just like before. Otherwise you won’t be able to translate your modules, which we want to avoid.

We’re still trying to find a workaround so that new modules can benefit from the new translation system, but that is not going to happen in a near future, unfortunately.

These comments do not apply to theme development, for the whole theme structure has been redesigned in 1.7. 1.7-specific themes should use the new translation system. Just not modules :(

 

Source:http://build.prestashop.com/news/new-translation-system-prestashop-17/#as-a-module-contributor

Link to comment
Share on other sites

Sh*t ! 

 

So guys said : Hurry up update your modules to 1.7.

 

Nice developers like me think : follow the new rules, so your modules will be up to date for a long time.

 

And now " We’re still trying to find a workaround so that new modules can benefit from the new translation system, but that is not going to happen in a near future, unfortunately."

 

Just a little idea for this STUPID developer which write this message : Do you have any plan to write it on the documentation that IT'S NOT WORKING and to NOT use it we lose a LOT of time to trying to make it work ! 

 

An Angry module developer !

  • Like 2
Link to comment
Share on other sites

  • 6 months later...

Hi there,

 

I hope Im in the right subject, I also tried to translate my module in Prestashop 1.7.2.1

I have a getContent.tpl file with a big form, then register variables in database with processConfiguration and assignConfiguration and display them in a mymodule.tpl.

 

I would like to know if there is a way to translate those variables ?

 

Thanks !

Paul

Link to comment
Share on other sites

  • 8 months later...
  • 3 months later...

The same problem is happening to me too. PrestaShop hasn't figured out how to get the new translation system working with modules, so we must continue to use the old translation system until they do. PrestaShop v1.7.5 will allow modules to use modern controllers. I'm hoping the translation domains will work with them.

Link to comment
Share on other sites

  • 8 months later...

This still seems not be resolved. I am running 1.7.2 and still can't translate the ps_emailsubscription module.

But it translates to Dutch on its own. Where does that translation come from? Because in the module it says:

 

return $this->trans('Thank you for subscribing to our newsletter.', array(), 'Modules.Emailsubscription.Shop');

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