Throughout my plugin I'm constructing sentences like this:

    if ($user_id == $author_id)
        $author = 'their own';
    elseif ($user_id == 0)
        $author = 'an';
    else
        $author = bp_core_get_userlink( $author_id ) . "'s";

    $action = bp_core_get_userlink( $user_id ) . ' likes ' . $author . ' <a
href="' . bp_activity_get_permalink($activity_id) . '">activity</a>';

What would be the best way of making this translatable? Something like this
perhaps:

    if ($user_id == $author_id) :
        $liker = bp_core_get_userlink( $user_id );
        $activity_url = bp_activity_get_permalink($activity_id);
        $action = sprintf(__('%s likes their own <a
href="%s">activity</a>'), $liker, $activity_url);
    elseif ($user_id == 0) :
        $liker = bp_core_get_userlink( $user_id );
        $activity_url = bp_activity_get_permalink($activity_id);
        $action = sprintf(__('%s likes an <a href="%s">activity</a>'),
$liker, $activity_url);
    else :
        $liker = bp_core_get_userlink( $user_id );
        $author = bp_core_get_userlink( $author_id );
        $activity_url = bp_activity_get_permalink($activity_id);
        $action = sprintf(__('%s likes %s\'s <a href="%s">activity</a>'),
$liker, $author, $activity_url);
    endif;

My only worry is that the sentences are almost identical, I don't want
translators having to do too much repetition.

-- Alex  (Hempsworth)
_______________________________________________
wp-polyglots mailing list
[email protected]
http://lists.automattic.com/mailman/listinfo/wp-polyglots

Reply via email to