Support » Requests and Feedback » Translation steps, where to go?

  • The template-function-comment.php file contains
    function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') and template-function-links-php contains function edit_post_link($link = 'Edit This', $before = '', $after = ''). If I want to translate these default values of Comment, Trackback, Pingback and Edit This, what would the best way be to ensure a proper translation?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mark (podz)


    Support Maven

    Ryan Boren


    WordPress Dev

    You cannot translate function argument defaults, but you can translate what is passed in. This means we need to change the templates to call comment_type() and edit_post_link() so that translated strings are passed in. This has already been done for edit_post_link in CVS. Instead of this:
    <?php edit_post_link(); ?>
    we now have this:
    <?php edit_post_link(__('Edit This')); ?>
    in index.php. The same needs to be done for comment_type() in wp-comments.php and wp-comments-popup.php. If someone writes a bug requesting to change the call to comment_type() in the templates, I’ll remember to fix it.

    The example allusion shows also gives the advantage that the control structure for what sort of comment (in the case of comment_type) can stay inside the function. With edit_post_link there is only one case but comment_type got three cases. Just adding gettext to the current comment_type function could possibly give a double translation, from A to B and from B to C, couldn’t it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Translation steps, where to go?’ is closed to new replies.