Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1053553
    Magik Web
    Participant

    We successfully translated 90% of the website to french, but can’t find the proper strings to translate the last few things from the blog section. We tried through WPML as seen in the attached files, but it didn’t budge the bottom of posts.

    How would you go at it?

    #1053859
    Christopher
    Moderator

    Hi there,

    Please add this in child theme’s functions.php file:

    add_filter('gettext', 'x_translate_text' , 20, 3);
    function x_translate_text ( $translated_text, $text, $domain ) {
    
    $translation = array (
    'Share on Facebook' => 'Partager sure Facebook',
    'Share via Email' => 'Partager sure Email',
    'Share on Google+' => 'Partager sure Google+'
    'Share on Linkedin' => 'Partager sure Linkedin'
    'Share on Twitter' => 'Partager sure Twitter'
    
    );
    
    if( isset( $translation[$text] ) ) {
    return $translation[$text];
    }
    
    return $translated_text;
    

    In regards with comment area provide us with URL.

    Hope it helps.

    #1054253
    Magik Web
    Participant

    I will try this as soon as I can, thank you very much for your efficient support.
    The URL to see the comment section is the following: https://v2.magikweb.ca/blogue/10-facons-davoir-un-site-web-securitaire

    #1054322
    Christopher
    Moderator

    Hi there,

    Please add following code in Customize -> Custom -> JavaScript :

    (function($){ 
    	$('html[lang=fr-FR] #reply-title.comment-reply-title').text('Your Text Here');
            $('html[lang=fr-FR] .comment-notes').text('Your Text Here');
    	$('html[lang=fr-FR] .comment-form-author label').text('Your Text Here *');
            $('html[lang=fr-FR] .comment-form-email label').text('Your Text Here *');
            $('html[lang=fr-FR] .comment-form-url label').text('Your Text Here');
            $('html[lang=fr-FR] .comment-form-comment label').text('Your Text Here');     
    
    })(jQuery)

    Hope that helps.

    #1065198
    Magik Web
    Participant

    For the “Share via” translation, the provided code worked! Here it is with the syntax fixes.

    /* Overrides a few strings for translation (WPML doesn't support them) */
    add_filter('gettext', 'x_translate_text' , 20, 3);
    function x_translate_text($translated_text, $text, $domain){
    
    	$translation = array (
    		'Share on Facebook'	=> 'Partager sur Facebook',
    		'Share via Email'	=> 'Partager sur Email',
    		'Share on Google+'	=> 'Partager sur Google+',
    		'Share on LinkedIn'	=> 'Partager sur Linkedin',
    		'Share on Twitter'	=> 'Partager sur Twitter'
    	);
    
    	if( isset( $translation[$text] ) ) {
    		return $translation[$text];
    	}
    	return $translated_text;
    }

    We tried the jQuery fix for the comment section, but it has a few issues.

    (function($){ 
    	$('html[lang=fr-FR] #reply-title.comment-reply-title').text('Laissez un commentaire');
    	$('html[lang=fr-FR] .comment-notes').text('1?');
    	$('html[lang=fr-FR] .comment-form-author label').text('2?');
      $('html[lang=fr-FR] .comment-form-email label').text('3?');
      $('html[lang=fr-FR] .comment-form-url label').text('4?');
      $('html[lang=fr-FR] .comment-form-comment label').text('Commentaire'); 
    })(jQuery)
    1. Since it’s fixed on the client side, will SEO robots register it properly?
    2. It seems like there’s a few missing strings such as the “Reply” (see attached file)

    Thank you for any follow up! 🙂

    #1065339
    Darshana
    Moderator

    Hi there,

    As you have pointed out, jQuery solution may tend to occur such SEO related issues. However you should be able to find those strings within your x.pot file and you can translate them using PoEdit as mentioned here on our guide (https://community.theme.co/kb/translation/).

    Thanks!

    #1066803
    Magik Web
    Participant

    The issue is resolved, after playing in WPML and changing the language code, the strings were applied properly. Possibly a bug of WPML not detecting the theme’s strings.

    Thank you for your help!

    #1066957
    Prasant Rai
    Moderator

    Happy to hear that. Feel free to ask us again. Have a great day! 🙂

  • <script> jQuery(function($){ $("#no-reply-1053553 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>