Translation steps, where to go? (4 posts)

  1. Anonymous
    Posted 12 years ago #

    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?

  2. Mark (podz)
    Support Maven
    Posted 12 years ago #

  3. Ryan Boren
    WordPress Dev
    Posted 12 years ago #

    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.

  4. Anonymous
    Posted 12 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.