Add langauge_attributes() template tag. #3136
git-svn-id: http://svn.automattic.com/wordpress/trunk@4218 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -129,15 +129,11 @@ function get_bloginfo($show='') {
|
||||
break;
|
||||
case 'language':
|
||||
$output = get_locale();
|
||||
if ( empty($output) )
|
||||
$output = 'en-US';
|
||||
$output = str_replace('_', '-', $output);
|
||||
break;
|
||||
case 'text_direction':
|
||||
global $wp_locale;
|
||||
$output = $wp_locale->text_direction;
|
||||
if ( empty($output) )
|
||||
$output = 'ltr';
|
||||
break;
|
||||
case 'name':
|
||||
default:
|
||||
@@ -870,4 +866,15 @@ function the_search_query() {
|
||||
echo wp_specialchars( stripslashes($s), 1 );
|
||||
}
|
||||
|
||||
function language_attributes() {
|
||||
$output = '';
|
||||
if ( $dir = get_bloginfo('text_direction') )
|
||||
$output = "dir=\"$dir\"";
|
||||
if ( $lang = get_bloginfo('language') ) {
|
||||
if ( $dir ) $output .= ' ';
|
||||
$output .= "lang=\"$lang\" xml:lang=\"$lang\"";
|
||||
}
|
||||
|
||||
echo $output;
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user