Jump to content

Can't translate strings from included tpl in a custom module


oblik

Recommended Posts

Hello,

 

I can't translate strings from an included tpl.

 

My TPL :

{if isset($productscoupdecoeur) && $productscoupdecoeur}
<div id="exemple-accueil-coupdecoeur">
    <h3 class="page-product-heading">- {l s='The' mod='testaccueil'} <span>{l s='favorites' mod='testaccueil'}</span> {l s='of users' mod='testaccueil'}... -</h3>
    {include file="$self/listcoupdecoeur.tpl"}
</div>
{/if}

Translations are ok in this file.

 

But in "listcoupdecoeur.tpl", the strings are not translated, i don't see them in the back office.

 <span>{l s='Quick view' mod="testaccueil"}</span>

Can you help me ?

 

Thanks

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

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

Hi,

Digging an old subject but since there are no answers on the web, it could be useful :

To translate a template that you fetch, you have to add the translation in the language translation file.

Exemple for this case :

$_MODULE['<{testaccueil}prestashop>listcoupdecoeur_c91e4ee170226d66e90f99ba917e4c20'] = 'Vue rapide';

Cheers

Link to comment
Share on other sites

  • 2 years later...
On 4/26/2019 at 10:22 AM, vcopleutre said:

Hi,

Digging an old subject but since there are no answers on the web, it could be useful :

To translate a template that you fetch, you have to add the translation in the language translation file.

Exemple for this case :

$_MODULE['<{testaccueil}prestashop>listcoupdecoeur_c91e4ee170226d66e90f99ba917e4c20'] = 'Vue rapide';

Cheers

Is there any way to update this file without modifying it manually?
If I have to modify it manually, how am I supposed to know what to write in c91e4ee170226d66e90f99ba917e4c20?

Link to comment
Share on other sites

  • 5 months later...

Getting back on my own post, proof that lacking of documentation is sometimes hard.

So for people still on 1.6 and @MrEduar

For common translations : (no module or admin)

$_LANG['name_of_your_tpl_file_MD5_of_the_translation_needed'] = 'Your translation';

with : for example

Which is gonna give you : (example for string 'Text #' and tpl shopping-cart.ajax.main.tpl)

$_LANG['shopping-cart.ajax.main_2fb3b950fd7711136f7f251ae5fbdbdc'] = 'Texte n°';

Do not forget the underscore between the name of the tpl and the MD5 hash.

Note : the file to update can be the main translation file or the one in your theme folder (ie : themes/theme_name/lang/fr.php) (change the iso code)

Edited by vcopleutre (see edit history)
  • Thanks 1
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...