How can I make $before (Books:) a translateable string

<?php echo get_the_term_list( $post->ID, 'book', 'Books: ',', ', ' ', '' ); ?>

with this method?:

<?php the_content(__('Read more...', "ft")); ?>

1 Answer 1


Use the __() function, just as you see in the the_content() example:

echo get_the_term_list( 
    // ID
    // taxonomy
    // Before
    __( 'Books: ', 'ft' ),
    // Separator, see http://core.trac.wordpress.org/ticket/7897
    __( ', ' ), 
    // After
    ' ', 
    // Looks like you've added an extra parameter?

Note 1: I split the word "Books" from the part of the string that (probably) shouldn't need to be translated - i.e. the colon and space.); the two parts of the parameter are concatenated. (Ed: Per @Toscho's suggestion, I changed this)

Note 2: Looks like you've added an extra parameter to your call to get_the_term_list()

  • Thanks again Chip! I'm lost between commas, apostrophes and semicolons...
    – elbatron
    Commented May 18, 2012 at 19:44
  • 1
    No worries! That's why I like to break functions down, line-by-line, if they have too many parameters. For me, that makes it easier to follow what I'm defining for each parameter, with the inline comments. Commented May 18, 2012 at 19:46
  • 2
    Chip are you sure about the position of the : (double colon plus space)? This looks probably rather strange untranslated in a RTL language, doesn't it?
    – fuxia
    Commented May 18, 2012 at 19:49
  • @Toscho: no, actually, I'm not sure. That's why I made the note to point it out. :) Commented May 18, 2012 at 19:50
  • Okay, I made the comma translatable too. Let's write showcases only. :)
    – fuxia
    Commented May 18, 2012 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.