Jump to content

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?

Link to comment
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.

Link to comment
Share on other sites

  • 6 months later...

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