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

    Pavle L
    Participant

    Hi support,

    Please could you help me how to translate Read More button, it seems that wmpl doesnt gives me that string translation. (is it posible not to be hardcoded)

    Here is what http://svetalata.com

    #236758

    Darshana
    Moderator

    Hi there,

    Thanks for writing in! 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.

    Then add the following code into your child theme’s functions.php file and translate the “Read More” wording.

    
    function x_excerpt_string( $more ) {
        
    $stack = x_get_stack();
    
      if ( $stack == 'integrity' ) {
        return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a></div>';
      } else if ( $stack == 'renew' ) {
        return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Read More', '__x__' ) . '</a>';
      } else if ( $stack == 'icon' ) {
        return ' ...';
      } else if ( $stack == 'ethos' ) {
        return ' ...';
      }
      
    }
    add_filter( 'excerpt_more', 'x_excerpt_string' );
    

    Hope that helps.

    #250178

    wordpressmarco
    Participant

    Thanks! I had the same issue and the solution helps!

    #250190

    Darshana
    Moderator

    Glad we were able to help 🙂

    #309112

    bvganev
    Participant

    Hello,

    I did the exact same procedure, but I keep on getting an error. Do you think the problem might stem from the fact that I translate from Latin letters to Cyrillic ones?

    Read more -> Прочети повече

    #309124

    Christopher
    Moderator

    Hi there,

    Would you clarify what error you get exactly?
    Please provide us with URL as well.

    Thanks.

    #309465

    bvganev
    Participant

    Parse error: syntax error, unexpected T_STRING on line 78

    #309550

    Thai
    Moderator

    Hi @bvganev,

    Please create a new ticket, then provide 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
    – FTP Account

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

    Thanks.

    #322271

    bvganev
    Participant
    This reply has been marked as private.
    #322344

    Zeshan
    Member

    Hi there,

    Thanks for writing in!

    Upon checking, I’m not seeing a child theme installed in your website. Can you please install it as per the instructions given in our earlier reply and try the following code again:

    function x_excerpt_string( $more ) {
        
      $stack = x_get_stack();
    
      if ( $stack == 'integrity' ) {
        return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Прочети повече', '__x__' ) . '</a></div>';
      } else if ( $stack == 'renew' ) {
        return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Прочети повече', '__x__' ) . '</a>';
      } else if ( $stack == 'icon' ) {
        return ' ...';
      } else if ( $stack == 'ethos' ) {
        return ' ...';
      }
      
    }
    add_filter( 'excerpt_more', 'x_excerpt_string' );
    

    Let us know how it goes.

    Thanks!

    #325171

    bvganev
    Participant

    Yes! It works seamlessly. Thank you!

    About about all the other default messages in English across the site? Where can I find them in order to translate them?

    #325187

    Paul R
    Moderator

    Hi,

    Please refer to the link below.

    https://community.theme.co//kb/translation/

    Hope that helps.

    #334211

    bvganev
    Participant

    Hello,

    Thank you for your advice. But I don’t wish to translate the whole theme, including the admin panel. I only want to translate these few default messages, such as:

    – When you search for non existing content
    “Search Results Below you’ll see everything we could locate for your search of….”
    “Nothing to Show Right Now It appears whatever you were looking for is no longer here or perhaps wasn’t here to begin with. You might want to try starting over from the homepage to see if you can find what you’re after from there.”

    – When you type in a wrong URL
    “Oops! You blew up the Internet. The page you are looking for is no longer here, or never existed in the first place (bummer). You can try searching for what you are looking for using the form below. If that still doesn’t provide the results you are looking for, you can always start over from the home page.”

    Can I find this texts within the .PO file?

    Thank you for your answer in advance!

    #334216

    Thai
    Moderator

    Hi @bvganev,

    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 (
    "Below you'll see everything we could locate for your search of " => "Your new text",
    'Nothing to Show Right Now' => "Your new text",
    "It appears whatever you were looking for is no longer here or perhaps wasn't here to begin with. You might want to try starting over from the homepage to see if you can find what you're after from there." => "Your new text",
    'The page you are looking for is no longer here, or never existed in the first place (bummer). You can try searching for what you are looking for using the form below. If that still doesn\'t provide the results you are looking for, you can always start over from the home page.' => "Your new text",
    "Oops!" => "Your new text",
    "You blew up the Internet. " => "Your new text",
    );
    
    if( isset( $translation[$text] ) ) {
    return $translation[$text];
    }
    
    return $translated_text;
    
    }

    You can replace the “Your new text” with your texts.

    Hope it helps.

    #350543

    medienkind
    Participant

    Hi there,

    is it possible to fix this via the Appearance/Custom CSS?

    I have only three Things that need translation. The “Read More…” Link, the “Leave a comment” Link and the “Submit” Button.

    It would be so convenient if I could change that vie the Custom CSS Field, not having to create a Child-theme.

    That would be so great! Thanx a bunch!
    Alex