Jump to content
Nomouku

Custom module translation problem

Recommended Posts

Hi!

Prestashop 1.7.6.1. Theme 'Autobase' was added after adding all necessary languages.

I can't translate 'Add to cart' button.

Line looks like:

<span class="cart-add">{l s='add to cart' d='Shop.Theme.Catalog'}</span>

And situated in file

PRESTA_ROOT/modules/wbfeature/views/templates/hook/wb_cart_button.tpl

Standart translation form in back-end doesn't contain this line. How i can add it manually?

I looked another strings with normal translation and didn't understand when and where the id generates in such lines:

<trans-unit id="9ff0635f5737513b1a6f559ac2bff745" approved="yes">

or

$_MODULE['<{wbfeature}prestashop>wb_compare_headlink_1f83af4e41052f8eb52dec322580a88d'] = 'compare';

How to add translation manually?

Share this post


Link to post
Share on other sites

I answer by myself.

'Trans-unit id' or code from your language file is md5 of phrase on english which must be translated.

In my case the following steps were needed.

From line

<span class="cart-add">{l s='add to cart' d='Shop.Theme.Catalog'}</span>

Copy "add to cart" (without quotes) and make md5. Result: 2d0f6b8300be19cf35e89e66f0677f95

Edit file

PRESTA_ROOT/modules/wbfeature/translations/[id].php

Where [id] - your language code (en, de, fr, ru, etc.)

Add line at the end of file

$_MODULE['<{wbfeature}prestashop>wb_cart_button_2d0f6b8300be19cf35e89e66f0677f95'] = 'Here is translated phrase';

Where:

wbfeature - module name

wb_cart_button - name of file, where situated phrase to translate ('wb_cart_button.php')

2d0f6b8300be19cf35e89e66f0677f95 - md5

Save changes.

Edit file

PRESTA_ROOT/modules/wbfeature/views/templates/hook/wb_cart_button.tpl

Add mod='wbfeature'

<span class="cart-add">{l s='add to cart' d='Shop.Theme.Catalog' mod='wbfeature'}</span>

Save changes.

After this, the changes were not effective immediately. But the corresponding line appeared in the back-end in localizations. Thus, I was able to add all the necessary translations.

I hope this helps someone.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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