Updated language attributes to work nicely with qTranslate - fixes #80

This commit is contained in:
Scott Walkinshaw
2011-07-11 12:55:11 -06:00
parent a87574c6ae
commit 4192053c3b

View File

@@ -132,15 +132,16 @@ add_action('pre_get_posts', 'roots_relative_feed_urls' );
function roots_language_attributes() { function roots_language_attributes() {
$attributes = array(); $attributes = array();
$output = ''; $output = '';
if (!defined('WP_LANG')) { $lang = get_bloginfo('language');
$attributes[] = "lang=\"en\""; if ($lang && $lang !== 'en-US') {
} else if ($lang = get_bloginfo('language')) { $attributes[] = "lang=\"$lang\"";
$attributes[] = "lang=\"$lang\""; } else {
} $attributes[] = 'lang="en"';
}
$output = implode(' ', $attributes); $output = implode(' ', $attributes);
$output = apply_filters('roots_language_attributes', $output); $output = apply_filters('roots_language_attributes', $output);
echo $output; return $output;
} }
add_filter('language_attributes', 'roots_language_attributes'); add_filter('language_attributes', 'roots_language_attributes');