WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to translate "Comments Off" (9 posts)

  1. S.K
    Member
    Posted 7 years ago #

    When I turn comments off for a post which has no comments yet, I get the text "Comments Off" on the main blog page under the particular entry. But this term (Comments Off) doesn't figure in the latest Pot file and I also find that that term doesn't have __() or _e() function in the file comments-template.php.

    I have a blog in Tamil (ta_IN) and I want that term to be translated.

    Could someone kindly tell me how to go about it.

    Thanks in advance.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    That text is most likely part of your theme. Look in your theme and change it there.

  3. S.K
    Member
    Posted 7 years ago #

    I checked up with all the theme files but couldn't find the string anywhere there. I confirmed that it is picked up only from line No.317 of the file "wp-includes/comments-template.php" since whatever change I make to the text "Comments Off" (No Comments, Comments None, BlahBlah, etc) over there appear on my blog page. I even tried to insert __() etc but it returns a syntax error message - my lack of knowledge of php is the reason.

    Kindly help.

    Thanks.

    S.K

  4. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    Look for the function comments_popup_link in your index.php, page.php or comments.php and change the strings according to this:
    http://codex.wordpress.org/Template_Tags/comments_popup_link

  5. S.K
    Member
    Posted 7 years ago #

    Thank you very much Azaozz.

    Yes, as you mentioned the hack hides the link to comments whenever comments are disabled for a post.

    But I discovered another problem:

    It is mentioned in the codex page linked by you as follows:

    Displays a link to the comments popup window if comments_popup_script() is used, otherwise it displays a normal link to comments.

    Now in my blog, in the header.php file, the comments_popup_script is put off as per the following line found there:

    <?php //comments_popup_script(); // off by default ?>
    Also, the comments are shown inline and not as a popup.

    In that case why is the popup_link (from the comments-template) is used? It beats me.

    How else to disable the comments_popup_link?

    Kindly help.

    PS:

    I have this line at the top of the index.php of my theme:

    <?php
    get_header();
    ?>

  6. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    The comments_popup_script() opens a pop-up window when you click on a comments_popup_link() link. As your comments are inline, you don't need to use comments_popup_link() to display the number of comments for a post, use the comments_number() instead.

    Search all *.php files in your theme and change comments_popup_link() to comments_number(), translating the strings. More info here:
    http://codex.wordpress.org/Template_Tags/comments_number

    Also look for something like
    `<?php else : // comments are closed ?>
    <!-- If comments are closed. -->
    <p class="nocomments">Comments are closed.</p>`

    shortly after the end of the comments loop - after endforeach;

    Hope that helps :)

  7. S.K
    Member
    Posted 7 years ago #

    Thanks Azaozz.

    It worked. But the link to the comments are replaced by mere text.

    Please help.

    S.K

  8. Andrew Ozz
    WordPress Dev
    Posted 7 years ago #

    I see what you mean... Why don't you try the example from comments_popup_link() page:

    <?php if ( comments_open() ) : ?>
    <p>
    <?php
    comments_popup_link( 'No comments yet', '1 comment',
    '% comments so far', 'comments-link', ''); ?>
    </p>
    <?php endif; ?>

    leaving the last string empty (as above). Or even just the comments_popup_link() part, without the "if" "endif" lines.

  9. S.K
    Member
    Posted 7 years ago #

    Thanks a Zillion, Azaozz!

    It worked and I have inserted a message of my choice between the '' and translated the text to my locale also!

    Very kind of you.

    S.K

Topic Closed

This topic has been closed to new replies.

About this Topic