Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #849600

    Ying-Fu Li
    Participant

    Hi,

    See attached image. Where can I translate those terms into Dutch? It can’t be done through the .po and .mo files (tried, words don’t even feature there). I tried some code in functions.php to no avail. Please help! ๐Ÿ˜‰

    #849722

    Thai
    Moderator

    Hi There,

    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 (
        'Your Name' => 'Your New Text',
        'Your Email' => 'Your New Text',
        'Your Website' => 'Your New Text',
        'Your Comment *' => 'Your New Text'
      );
    
      if( isset( $translation[$text] ) ) {
        return $translation[$text];
      }
    
      return $translated_text;
    
    }

    Hope it helps.

    #849741

    Ying-Fu Li
    Participant

    It did, thanks. Just one thing: it translated ‘REAGEER’ back to ‘YOUR TEXT HERE’…

    Also, how can I target that button to change the text color to white?

    http://www.heldenopreis.nl/held-op-sokken-gastblog-martin-akker/

    #849870

    Rupok
    Member

    Hi there,

    Thanks for updating.
    You can add this under Custom > CSS in the Customizer.

    .x-btn, .button, [type="submit"] {
      color: #fff;
    }

    Hope this helps.

    Cheers!

    #850077

    Ying-Fu Li
    Participant

    Thanks.

    Translation: after some left over code was removed it worked except for ‘Your Comment *’ => ‘Your New Text’ which remains in English. Any thoughts?

    http://heldenopreis.nl/helden-op-reis-canada/

    #850368

    Rad
    Moderator

    Hi there,

    Hmm, that’s weird. You’re correctly targeting the exact string. Would you mind changing this line of code

    add_filter('gettext', 'x_translate_text' , 20, 3);

    to this,

    add_filter('gettext', 'x_translate_text' , 99999, 3);

    Just to make sure that it’s executed after any translation. And for the meantime, you can also edit the strings directly from this file \wp-content\themes\x\framework\views\ethos\wp-comments.php and copy the same file to your child theme.

    Hope this helps.

    #851037

    Ying-Fu Li
    Participant

    Both resulted in nothing ๐Ÿ˜‰

    #851473

    Rad
    Moderator

    Hi there,

    In that case, 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
    – FTP credentials

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

    Thanks!