Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #250321

    Ilya K
    Participant

    Hi!

    I’m having problems with localization with X theme.

    https://yadi.sk/i/S2UoQungg2AQY

    What I want is the following (as in default Woocommerce theme)

    https://yadi.sk/i/0F63t3i4g2AVN

    E.g. it seems that some X theme options override default Woocommerce translation (currently it is 100% translated into russian).

    Please help.

    #250437

    Thai
    Moderator

    Hi There,

    Thanks for writing in!

    In order to translate those strings, you can simply use following code in your child theme’s functions.php file:

    
    add_filter('gettext', x_translate_text , 20, 3);
    function x_translate_text ( $translated_text, $text, $domain ) {
    
    $translation = array (
    'Attribute' => 'Your new Russian language',
    'Color' => 'Your new Russian language',
    );
    
    if( isset( $translation[$text] ) ) {
    return $translation[$text];
    }
    
    return $translated_text;
    
    } 
    

    You can add more English texts to the code above.
    Hope it helps.

    #251046

    Ilya K
    Participant

    Thanks!

    #251050

    Rue Nel
    Moderator

    You are welcome 🙂