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

    Dannys106
    Participant

    Hello,

    I would like to change the leave a reply into another language and I would like to change some text on the submit button and some of the fiels of it. Does anyone know how to change this because I see it’s in the x-comments-area, but where can I find that file on the FTP?

    Thank you very much!

    Kind regards,

    Danny

    Milkomulder.nl

    #102351

    Onur M
    Participant

    You can use PoEdit program to change the language of the objects in your theme.
    You should find .mo and .po files in your themes lang folder, and edit them with poedit.

    #102357

    Mrinal
    Member

    Hi Danny,

    As Onur said, you need to translate the theme. Please follow this KB article or use a plugin to translate the strings of theme: https://wordpress.org/plugins/loco-translate/

    Thank you Onur for your perfect suggestion, much appreciated!

    Have a nice day guys, Cheers!

    #102943

    Dannys106
    Participant

    Hello,

    It doesn’t work he can’t find the sentence: Leave a reply, and if i look in the sourcecode it says that it will be there. How can I change this sentence in the sourcecode on the FTP?

    How can I change the h3 tag?

    <div id=”comments” class=”x-comments-area”>

    <div id=”respond” class=”comment-respond”>
    <h3 id=”reply-title” class=”comment-reply-title”>Leave a Reply <small>Cancel reply</small></h3>
    <form action=”http://milkomulder.nl/wp-comments-post.php” method=”post” id=”commentform” class=”comment-form”>
    <p class=”comment-notes”>Your email address will not be published. Required fields are marked <span class=”required”>*</span></p> <p class=”comment-form-author”><label for=”author”>Name <span class=”required”>*</span></label> <input id=”author” name=”author” type=”text” value=”” size=”30″ aria-required=”true”></p>
    <p class=”comment-form-email”><label for=”email”>Email <span class=”required”>*</span></label> <input id=”email” name=”email” type=”text” value=”” size=”30″ aria-required=”true”></p>
    <p class=”comment-form-url”><label for=”url”>Website</label> <input id=”url” name=”url” type=”text” value=”” size=”30″></p>
    <p class=”comment-form-comment”><label for=”comment”>Comment</label> <textarea id=”comment” name=”comment” cols=”45″ rows=”8″ aria-required=”true”></textarea></p> <p class=”form-submit”>
    <input name=”submit” type=”submit” id=”entry-comment-submit” value=”Submit”>
    <input type=”hidden” name=”comment_post_ID” value=”6633″ id=”comment_post_ID”>
    <input type=”hidden” name=”comment_parent” id=”comment_parent” value=”0″>
    </p>
    <p style=”display: none;”><input type=”hidden” id=”akismet_comment_nonce” name=”akismet_comment_nonce” value=”04865ee31e”></p><p style=”display: none;”></p> <input type=”hidden” id=”ak_js” name=”ak_js” value=”1410460879795″></form>
    </div><!– #respond –>

    </div>

    #102983

    Mrinal
    Member

    Hi Danny,

    The file is located here: X/FRAMEWORK/VIEWS/INTEGRITY/WP-COMMENTS.PHP.

    As 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.

    #103004

    Dannys106
    Participant

    hello,

    Thank you! I have installed the child theme, but if i go to that file, I will get the following text, and I don’t see the sentence: leave a reply and some h3 tags? Where are they? I only see some functions.

    Thanks:

    <?php

    // =============================================================================
    // VIEWS/INTEGRITY/WP-COMMENTS.PHP
    // —————————————————————————–
    // The area of the page that contains both current comments and the comment
    // form. The actual display of comments is handled by a callback to
    // x_comment().
    // =============================================================================

    ?>

    <?php

    //
    // 1. If the current post is protected by a password and the visitor has not
    // yet entered the password, we will return early without loading the
    // comments.
    //

    if ( post_password_required() )
    return; // 1

    ?>

    <div id=”comments” class=”x-comments-area”>

    <?php if ( have_comments() ) : ?>

    <h2 class=”h-comments-title”><span><?php _e( ‘Comments’ , ‘__x__’ ); ?> <small><?php echo number_format_i18n( get_comments_number() ); ?></small></span></h2>

      <?php
      wp_list_comments( array(
      ‘callback’ => ‘x_integrity_comment’,
      ‘style’ => ‘ol’
      ) );
      ?>

    <?php if ( get_comment_pages_count() > 1 && get_option( ‘page_comments’ ) ) : ?>
    <nav id=”comment-nav-below” class=”navigation” role=”navigation”>
    <h1 class=”visually-hidden”><?php _e( ‘Comment navigation’, ‘__x__’ ); ?></h1>
    <div class=”nav-previous”><?php previous_comments_link( __( ‘← Older Comments’, ‘__x__’ ) ); ?></div>
    <div class=”nav-next”><?php next_comments_link( __( ‘Newer Comments →’, ‘__x__’ ) ); ?></div>
    </nav>
    <?php endif; ?>

    <?php if ( ! comments_open() && get_comments_number() ) : ?>
    <p class=”nocomments”><?php _e( ‘Comments are closed.’ , ‘__x__’ ); ?></p>
    <?php endif; ?>

    <?php endif; ?>

    <?php
    comment_form( array(
    ‘comment_notes_after’ => ”,
    ‘id_submit’ => ‘entry-comment-submit’,
    ‘label_submit’ => __( ‘Submit’ , ‘__x__’ )
    ) );
    ?>

    </div>

    #103046

    Mrinal
    Member

    Hi Danny,

    Really sorry that we didn’t got your point.

    To change the Leave a reply title in comment form, add the following jQuery codes via Appearance > Customize > Custom > JS

    (function($){ 
    	$('#reply-title.comment-reply-title').text('Your Text Here');
    })(jQuery)

    The h3 tag can’t be changed as the whole comment form is generated from WordPress core, it requires huge customization which is out of our support scope. And I can see there in no plugin available to change that easily. So at the moment you just have to stick with renaming/changing Leave a reply

    #103090

    Dannys106
    Participant

    Hello,

    Thank you! This works, but now I need to change more of the words:

    http://milkomulder.nl/?page_id=6633

    – Your email address will not be published. Required fields are marked.
    must be “Jouw emailadres zal niet worden gepubliceerd. Verplichte velden zijn gemarkeerd”

    I want to change color to white also instead of grey, you can see it at the page:)
    http://milkomulder.nl/?page_id=6633

    – Name must be “naam”
    – comment must be “bericht”
    – submit must be “bevestigen”

    Many thanks!

    Kind regards,

    Danny

    #103113

    Mrinal
    Member

    To do so, add the following codes instead of previous:

    
    (function($){ 
    	$('#reply-title.comment-reply-title').text('Your Text Here');
            $('.comment-notes').text('Your Text Here');
    	$('.comment-form-author label').text('Your Text Here *');
            $('.comment-form-email label').text('Your Text Here *');
            $('.comment-form-url label').text('Your Text Here');
            $('.comment-form-comment label').text('Your Text Here');     
    
    })(jQuery)
    

    And now about submit buttton, it can be translated via Loco Translate plugin or manual translation using PO file described earlier

    #103120

    Dannys106
    Participant

    Thank you very much! Is the submit button the only way to do it by the POEdit or Loco translate plugin? Is there no other way?

    And how can I change the color of the following sentence, because I want it white:)

    $(‘.comment-notes’).text(‘Your Text Here’);

    Thank you!

    Regards,

    Danny

    #103142

    Rad
    Moderator

    Hi Danny,

    If you’re using multilingual setup where you can switch back and forth, then you should use the PO files. Loco plugin will pick strings from PO files, so you may edit them withj POEdit.

    If you’re not using multilingual, then you can just use force translate by php coding.

    Example, add this code at your child theme’s functions.php

    add_filter('gettext', function($ttxt, $txt, $d) {
    
    if($txt == 'Submit') return 'YOUR SUBMIT STRING HERE';
    return $ttxt;
    
    });

    For coloring .comment-notes, then just add this css at your customizer’s custom css.

    .comment-notes {
    color: #fff;
    }

    Cheers!

    #104969

    Naggenum
    Participant

    Hey guys,

    I’m using the German version of WP and have a similar problem. For my blog’s comments, I’d like to change the text of the “Submit” button into German. The same goes for the last part of my first blog entry’s subheader, which is displayed in the format “Author / Date / Category / Leave a Comment” (as you can see here: http://www.sans-lorch.de/wordpress/winzer-blog-start/#comments) … “Leave a Comment” should be translated into German, too.

    I installed the POEdit program and searched the .po files for “Submit” and “Leave a Comment” but I didn’t find the appropriate lines. PHP-coding didn’t work either – adding the code described above to my functions.php caused a php-error on my site. How do I get this language thing straight?

    #105039

    Zeshan
    Member

    Hi Neggenum,

    Thank you for writing in!

    Instead of using the above code, please try added the following in your child theme’s functions.php file:

    add_filter('gettext', 'translate_text_to_germen', 20, 3);
    
    function translate_text_to_germen($ttxt, $txt, $d) {
    
       switch ($txt) {
          case 'Submit':
             return 'ADD TEXT TO REPLACE WITH "Submit" HERE'; // Change text here
             break;
          
          case 'Leave a Comment':
             return 'ADD TEXT TO REPLACE WITH "Leave a Comment" HERE'; // Change text here
             break;
       }
    
       return $ttxt;
    
    }
    

    Hope this helps. 🙂

    Thank you.

    #105159

    Naggenum
    Participant

    Changed “germen” in your code to “german”. Apart from that, it worked perfectly fine!

    Great job, thanks a lot =)

    #105162

    Cousett
    Member

    Glad you were able to figure it out. 🙂 Have a nice day.