Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #992239
    NailedIT
    Participant

    Hi there,

    I have translated the theme with a child theme (like it is explained here: https://community.theme.co/kb/translation/ ) and it works basically.

    Unfortunately some strings are not translated, even though I have translated them in the .po/.mo files:

    1. The subtitle of the comments section is not translated:
    – If only 1 comment is made: “One Comment on” instead of the translation. See here for an example: http://new.nailedit.ch/5-regeln-erfolgreicher-blogposts-die-gelesen-und-geteilt-werden/
    – If more than 1 comment are made: “8 Comments on” instead of the translation. See here for an example: http://new.nailedit.ch/checkliste-rechtlich-sichere-website-schweiz/

    2. The hover text of the social share buttons shortcode (“Share on Facebook”, “Share on Twitter”) are also not translated. You can see an example on the same links as above (I added the shortcode to all blog posts).

    I assume this is a bug, as this problem did not occur with another theme.

    Thanks and best regards,
    Michael

    #992336
    Christian
    Moderator

    Hey Michael,

    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.

    #993773
    NailedIT
    Participant
    This reply has been marked as private.
    #994222
    Rahul
    Moderator

    Hey,

    They should translatable. But, you can always override it directly by adding this code at your child theme’s functions.php

    if ( ! function_exists( 'x_renew_comment' ) ) :
      function x_renew_comment( $comment, $args, $depth ) {
    
        $GLOBALS['comment'] = $comment;
        switch ( $comment->comment_type ) :
          case 'pingback' :  // 1
          case 'trackback' : // 1
        ?>
        <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
          <p><?php _e( 'Pingback:', '__x__' ); ?> <?php comment_author_link(); ?> <?php edit_comment_link( __( '(Edit)', '__x__' ), '<span class="edit-link">', '</span>' ); ?></p>
        <?php
            break;
          default : // 2
          GLOBAL $post;
          if ( X_WOOCOMMERCE_IS_ACTIVE ) :
            $rating = esc_attr( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) );
          endif;
          if ( x_is_product() ) {
            $comment_avatar = get_avatar( $comment, 240 );
          } else {
            $comment_avatar = get_avatar( $comment, 120 );
          }
        ?>
        <li id="li-comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>
          <article id="comment-<?php comment_ID(); ?>" class="comment">
            <?php
            printf( '<div class="x-comment-img">%s</div>',
              '<span class="avatar-wrap cf">' . $comment_avatar . '</span>'
            );
            ?>
            <?php if ( ! x_is_product() ) : ?>
            <div class="x-reply">
              <?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply <span class="comment-reply-link-after"><i class="x-icon-reply" data-icon=""></i></span>', '__x__' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
            </div>
            <?php endif; ?>
            <div class="x-comment-wrap">
              <header class="x-comment-header">
                <?php
                printf( '<cite class="x-comment-author">%1$s</cite>',
                  get_comment_author_link()
                );
                if ( x_is_product() && get_option('woocommerce_enable_review_rating') == 'yes' ) : ?>
                  <div class="star-rating-container">
                    <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating" class="star-rating" title="<?php echo sprintf( __( 'Rated %d out of 5', '__x__' ), $rating ) ?>">
                      <span style="width:<?php echo ( intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ) / 5 ) * 100; ?>%"><strong itemprop="ratingValue"><?php echo intval( get_comment_meta( $GLOBALS['comment']->comment_ID, 'rating', true ) ); ?></strong> <?php _e( 'out of 5', '__x__' ); ?></span>
                    </div>
                  </div>
                <?php endif;
                printf( '<div><a href="%1$s" class="x-comment-time"><time datetime="%2$s">%3$s</time></a></div>',
                  esc_url( get_comment_link( $comment->comment_ID ) ),
                  get_comment_time( 'c' ),
                  sprintf( __( '%1$s at %2$s', '__x__' ),
                    get_comment_date( 'm.d.Y' ),
                    get_comment_time()
                  )
                );
                edit_comment_link( __( '<i class="x-icon-edit" data-icon=""></i> Edit', '__x__' ) );
                ?>
              </header>
              <?php if ( '0' == $comment->comment_approved ) : ?>
                <p class="x-comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', '__x__' ); ?></p>
              <?php endif; ?>
              <section class="x-comment-content">
                <?php comment_text(); ?>
              </section>
            </div>
          </article>
        <?php
            break;
        endswitch;
    
      }
    endif;

    Just change “Reply” and “%1$s at %2$s”

    Hope this helps.

    #995568
    NailedIT
    Participant

    Hi there,

    Thanks for your reply, but I didn’t want to hack something that should work. So I investigated a little bit further and here is the solution for everyone with the same problem:

    If you load the .po/.mo translation file in your child theme (what absolutely makes sense, because you don’t want to have your .po/.mo files overwritten on a theme update. See here how you can do it: https://community.theme.co/forums/topic/language-po-files-and-child-theme/#post-146225), then sometimes the strings are changed in the .po file, like in this case:
    One Comment on &ldquo;%2$s&rdquo;
    becomes
    One Comment on %2$s

    And now of course the translations don’t work anymore and you have to update the .po/.mo translation files.

    A little tip on how to update your outdated .po file in your child theme, without doing all translations again:
    1. Download and install Poedit (it’s free): https://poedit.net/ (sometimes the Loco Translate plugin may be enough, but trust me, a real .po editor is so much easier and safer to use).
    2. Download the current X theme (contains the current .pot translation template file).
    3. Open your child themes translated .po file with Poedit and update your .po file with the “Update from POT file…” function (choose the .pot file in the downloaded X theme).
    4. Translate the changed/newly added strings, save and reupload the .po and .mo files to your child theme on your server.
    5. ???
    6. PROFIT!

    Maybe that helps somebody 🙂

    Best regards,
    Michael

    #995746
    Darshana
    Moderator

    Hi Michael,

    You have done it correctly & thanks for sharing it with other members 🙂

    Cheers!

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