From 8e21f7f098e35b9591dd20a99e1efff41f62dbdd Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 27 Apr 2011 21:25:09 +0000 Subject: [PATCH] Translate default link labels for *posts_link(). Props nathanrice, CharlesClarkson. fixes #16998 git-svn-id: http://svn.automattic.com/wordpress/trunk@17728 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 434d2217a..727cf9cc5 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1579,7 +1579,7 @@ function next_posts( $max_page = 0, $echo = true ) { * @param int $max_page Optional. Max pages. * @return string|null */ -function get_next_posts_link( $label = 'Next Page »', $max_page = 0 ) { +function get_next_posts_link( $label = null, $max_page = 0 ) { global $paged, $wp_query; if ( !$max_page ) @@ -1589,6 +1589,9 @@ function get_next_posts_link( $label = 'Next Page »', $max_page = 0 ) { $paged = 1; $nextpage = intval($paged) + 1; + + if ( null === $label ) + $label = __( 'Next Page »' ); if ( !is_single() && ( $nextpage <= $max_page ) ) { $attr = apply_filters( 'next_posts_link_attributes', '' ); @@ -1605,7 +1608,7 @@ function get_next_posts_link( $label = 'Next Page »', $max_page = 0 ) { * @param string $label Content for link text. * @param int $max_page Optional. Max pages. */ -function next_posts_link( $label = 'Next Page »', $max_page = 0 ) { +function next_posts_link( $label = null, $max_page = 0 ) { echo get_next_posts_link( $label, $max_page ); } @@ -1655,9 +1658,12 @@ function previous_posts( $echo = true ) { * @param string $label Optional. Previous page link text. * @return string|null */ -function get_previous_posts_link( $label = '« Previous Page' ) { +function get_previous_posts_link( $label = null ) { global $paged; + if ( null === $label ) + $label = __( '« Previous Page' ); + if ( !is_single() && $paged > 1 ) { $attr = apply_filters( 'previous_posts_link_attributes', '' ); return '". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&$1', $label ) .''; @@ -1672,7 +1678,7 @@ function get_previous_posts_link( $label = '« Previous Page' ) { * * @param string $label Optional. Previous page link text. */ -function previous_posts_link( $label = '« Previous Page' ) { +function previous_posts_link( $label = null ) { echo get_previous_posts_link( $label ); }