Jump to content

Problem with module translation


psg

Recommended Posts

Hi,

 

I'm trying get the translation for a module.

 

I make a PHP file with this code for display the footer Prestashop where shows the blocknewsletter module:

Quote
<?php
    
    $language = new Language(Configuration::get('PS_LANG_DEFAULT'));
    $context->language = $language;   
 
    ob_start();
    $controllerF = new FrontController();
   $controllerF->init();
 
   $controllerF->displayFooter();
   $footer = ob_get_contents();
   ob_end_clean();
 
    //  PAINT FOOTER 
    echo $footer;
 
?>

 

The web page is in two laguanges, portuguese and spainsh. I want to display in both languages, but the blocknewsletter module ever displays in spanish language.

 

If I see the web page in portuguese, all display in portuguese without the module, see the example:

image.png.cdf15afb422832b6ca7a0ada4b1d7391.png

 

¿How can I show the portuguese module?

 

¡The module is translated to portuguese in Location > Translate in Backend Prestashop!

 

Thnks

Edited by psg (see edit history)
Link to comment
Share on other sites

On 9/7/2018 at 7:48 PM, psg said:

Hi,

 

I'm trying get the translation for a module.

 

I make a PHP file with this code for display the footer Prestashop where shows the blocknewsletter module:

 

The web page is in two laguanges, portuguese and spainsh. I want to display in both languages, but the blocknewsletter module ever displays in spanish language.

 

If I see the web page in portuguese, all display in portuguese without the module, see the example:

image.png.cdf15afb422832b6ca7a0ada4b1d7391.png

 

¿How can I show the portuguese module?

 

¡The module is translated to portuguese in Location > Translate in Backend Prestashop!

 

Thnks

 

Hi,

As per our understanding, it will always display the text in one language i.e. Default language because instead of the passing the language parameter from the context you have passed the Configuration::get('PS_LANG_DEFAULT') in new Language constructor(which will always be same depending upon the default language of the PrestaShop)

Check after passing the language id from context like Context::getContext()->language->id

I hope it will help.

 

 

 

Link to comment
Share on other sites

22 hours ago, Knowband Plugins said:

Hola,

Según nuestro entendimiento, siempre mostrará el texto en un idioma, es decir, el idioma predeterminado, porque en lugar de pasar el parámetro de idioma del contexto que ha pasado la  Configuración :: get ('PS_LANG_DEFAULT') en el nuevo constructor de Idioma (que siempre será lo mismo dependiendo del idioma predeterminado de PrestaShop)

Compruebe después de pasar el ID de idioma desde contexto como Context :: getContext () -> language-> id

Espero que ayude

 

Thanks your for your answer.

 

If put in the code:

var_dump(Context::getContext()->language->id);

 

it prints "(int) 4" 

 

4 is the portuguese language, is the good language but the translation module is not good and he is displayed in spanish.

 

Link to comment
Share on other sites

On 7/9/2018 at 4:29 PM, Rolige said:

Hello,
Maybe the translations of the module has been overridden from the theme, try again check the module translatios, but this time select for "theme" instead "core

Regards!

 

Thnks for your answer.

 

The module isn't override.

Link to comment
Share on other sites

On 9/10/2018 at 1:11 PM, psg said:

 

Thanks your for your answer.

 

If put in the code:

var_dump(Context::getContext()->language->id);

 

it prints "(int) 4" 

 

4 is the portuguese language, is the good language but the translation module is not good and he is displayed in spanish.

 

 

Okay. It's quite strange !!! 

Have checked the translation from the admin? Means text of the modules are correct?

 

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