Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1123246

    Patrick Rosemeyer
    Participant

    Hi,

    Currently I have the problem that I can’t translate the shop title with WPML (see attachment). I use the title also for the breadcrumb (see attachment). WPML can not find the appropriate string. I use the icon stack and .

    Thank you in advanced

    Patrick

    #1123337

    Nico
    Moderator

    Hi There,

    Thanks for writing in.

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1123571

    Patrick Rosemeyer
    Participant
    This reply has been marked as private.
    #1124053

    Nabeel A
    Moderator

    Hi again,

    Thank you for providing the credentials. Try manual string translation method by adding the following code in your Child Theme’s functions.php file

    add_filter ('gettext', 'x_translate_text', 99, 3 );
    
    function x_translate_text ( $translated_text, $text, $domain ) {
    
    $translation = array (
    'Shop' => 'Geschäft'
    );
    
    if( isset( $translation[$text] ) ) {
    return $translation[$text];
    }
    
    return $translated_text;
    
    }

    The $translation = array() contains the original string and the translation string. The original string should match the extract string you wish to translate. Any space or mismatched characters will invalidate the translation.

    Hope this helps!

    #1124223

    Patrick Rosemeyer
    Participant

    Hi Nabeel A,

    thank you for the code. But it don’t works. Which is the correct string of the shop title appearance — icon — shop options – shop title?

    This is actual my code in functions.php in child theme:

    add_filter ('gettext', 'x_translate_text', 99, 3 );
    
    function x_translate_text ( $translated_text, $text, $domain ) {
    
    $translation = array (
    'Shop - besondere Dekoideen und Holzspielzeug' => 'Geschäft'
    );
    
    if( isset( $translation[$text] ) ) {
    return $translation[$text];
    }
    
    return $translated_text;
    
    }  

    Is this correct. And how can I translate in WPML? WPML can’t find the string for translation.

    best regards
    Patrick

    #1125721

    Jack
    Keymaster

    Hi Patrick,

    Thanks for writing back.

    It seems that the second part of what you are trying to translate:
    besondere Dekoideen und Holzspielzeug
    is a category name, try translating those separately.

    Like this:

    <?php
    
    add_filter ('gettext', 'x_translate_text', 99, 3 );
    
    function x_translate_text ( $translated_text, $text, $domain ) {
    
    $translation = array (
    'Shop' => 'Geschäft',
    'besondere Dekoideen und Holzspielzeug' => 'your-translation'
    );
    
    if( isset( $translation[$text] ) ) {
    return $translation[$text];
    }
    
    return $translated_text;
    
    }  

    As in the code you posted, you had a hypen character in it, which is actually part of the breadcrumb path and not a string in itself.

    Let us know if you still have any problems, we’re here to help. 🙂

    Thanks!

    #1125722

    Patrick Rosemeyer
    Participant

    Hi guys,

    can I get an answer?

    Best regards
    Patrick

    #1125981

    Joao
    Moderator

    Hi Patrick,

    Have you tried the solution provided by Jack?

    Let us know.

    Thanks

    Joao

    #1128556

    Patrick Rosemeyer
    Participant

    Hey Jack and Joao,

    thank you for your reply. I had written my message at the same moment as Jack. Sorry!

    The solution of Jack don’t works. I would like to translate the string to the page title of the Shop Main page contains. There is no category but it show the shop title in the breadcrumbs.

    I would like to translate SHOP – Besondere Dekoideen und Holzspielzeug to shop – special decoration ideas and wooden toys. But I can’t find the string with WPML to translate it.

    I need translations in six languages (at,ch,en,gb,fr,es)

    Best regards
    Patrick

    #1128729

    Jack
    Keymaster

    Hi Patrick,

    Thanks for writing back and the additional clarification.

    Would it be possible to provide me with FTP and WP Admin please so I can try and resolve this for you. If so please provide the details and make sure to check the box that says Set as private reply.

    I’ll then check the template files and find the correct string.

    Thank you!

    #1129697

    Patrick Rosemeyer
    Participant
    This reply has been marked as private.
    #1129769

    Rue Nel
    Moderator

    Hello Patrick,

    To translate it, you need to go to WPML > Translation Management and find the shop title “SHOP – BESONDERE DEKOIDEEN UND HOLZSPIELZEUG”. As of this moment, there was no translation added for this as shown here: http://prntscr.com/c55ugc

    Hope this helps.

    #1131557

    Patrick Rosemeyer
    Participant

    Hello Rue Nel,

    thank you for your reply! Your screenshot shows the translation of the page, but not the translation of the title in custom settings of X-theme. I need a possibility of translation of the shop title that shows in the attachment Ashampoo_Snap_2016.08.09_07h51m49s_002_1.jpg.

    Thanks
    Patrick

    #1132136

    Rad
    Moderator

    Hi there,

    Let’s enable the translation first 🙂

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    1. Copy this file \wp-content\themes\x\framework\views\icon\woocommerce.php to your child theme (eg. \wp-content\themes\x-child\framework\views\icon\woocommerce.php )

    2. Edit your child theme’s framework\views\icon\woocommerce.php and replace this line of code

    <h1 class="entry-title"><?php echo x_get_option( 'x_icon_shop_title' ); ?></h1>

    with this line,

    <h1 class="entry-title"><?php echo __( x_get_option( 'x_icon_shop_title' ), '__x__' ); ?></h1>

    3. Save and upload it.

    4. Now translate the string “Shop – besondere Dekoideen und Holzspielzeug”

    The x_get_option( ‘x_icon_shop_title’ ) is the one that holds the string from customizer. Adding __() will enable the translation for the string you added on customizer’s shop title.

    Hope this helps.