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")); ?>
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It only takes a minute to sign up.
Sign up to join this communityHow 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")); ?>
Use the __()
function, just as you see in the the_content()
example:
<?php
echo get_the_term_list(
// ID
$post->ID,
// taxonomy
'book',
// 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()
:
(double colon plus space)? This looks probably rather strange untranslated in a RTL language, doesn't it?
– fuxia♦
May 18 '12 at 19:49