Home Forums Basel support forum Close Button translation

Close Button translation

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #50856

    Majed-RO
    Participant

    Hi guys,

    When I click on “compare” button in the product page, a popup windows appears with big “close” button below it.
    I want to know where I can translate this button. I tried to translate all “close” strings in the basel.po file with no effect.

    Anyone has a clue?

    Thanks

    #50882

    Hello,

    Do you use WPML or just want to rewrite?

    Best Regards

    #50888

    Majed-RO
    Participant

    No, I don’t use WPML. I use loco translator. By the way, I noticed this modal window related to jquery colorbox and thus it may need some customization in js files ( I hope not )

    #50928

    Artem Temos
    Keymaster

    Hello,

    We investigated this issue and noticed a bug in the compare plugin. This word can’t be translated with the Loco Translate plugin. You can do this manually editing a file plugins/yith-woocommerce-compare/includes/class.yith-woocompare-frontend.php
    http://prntscr.com/j13qip

    #50987

    Majed-RO
    Participant

    Thank you.

    I have solved this issue, and I will write it down for others who would like to do the same.

    First, this string is located in : plugins/yith-woocommerce-compare/includes/class.yith-woocompare-frontend.php
    line 213
    ‘close_label’ => _x( ‘Close’, ‘Label for popup close icon’, ‘yith-woocommerce-compare’ )

    note the function _x() needs 3 parameters, the second is the context. And the generated po file by Loco plugin doesn’t have the context lines, so you will tweak one line to make it work.

    Steps:
    1- open the Poedit software. open the plugin translation file (yith-woocommerce-compare-<your_language_letters>.po). Go to Catalog, then properties , then click on Sources Keywords tab.
    here you should edit values as follows:
    __
    _e
    _n:1,2
    _x:1,2c
    _ex:1,2c

    Save and close.

    2- Edit the previous file by any editor ( yith-woocommerce-compare-<your_language_letters>.po ). and go to this line:
    #: ../includes/class.yith-woocompare-frontend.php:213
    msgid “Close”
    msgstr “إغلاق”

    and replace it by:
    #: ../includes/class.yith-woocompare-frontend.php:213
    msgctxt “Label for popup close icon”
    msgid “Close”
    msgstr “إغلاق”

    3- Now you have to compile the file to MO extension by opening the same file by Poedit then save or File -> compile to MO

    4- upload the file to wp-content/languages/loco/plugins

    That’s it.

    #51004

    Artem Temos
    Keymaster

    Hello,

    Thank you for sharing your solution here!

    Kind Regards

    #55747

    Majed-RO
    Participant

    By the way, there is a bug in Basel theme realted to the same issue:

    File: inc/template-tags.php
    line: 1251

    Instead of esc_attr__ , it should be esc_attr_x

    #55770

    Eric Watson
    Participant

    Hello,

    Could you please explain in more detail about which bug you are talking about and provide a screenshot of the code.

    Kind Regards
    XTemos Studio

    #55830

    Majed-RO
    Participant

    Please see the attached screenshots, one for the code, and another for the frontend.

    I noticed, when translating the .po file which related to “Search for products”, it will not show up in the frontend. After I changed the function from esc_attr__ to esc_attr_x , it works fine.

    Thank you.

    Attachments:
    You must be logged in to view attached files.
    #55840

    Eric Watson
    Participant

    Hi,

    OK, thank you. We will definitely add this fix in our next update.

    Best Regards

Viewing 10 posts - 1 through 10 (of 10 total)