Commit b75c1e1c authored by Steven Wittens's avatar Steven Wittens

Replace hardcoded <html lang="en"> with a locale dependant one. This is...

Replace hardcoded <html lang="en"> with a locale dependant one. This is especially important for asian sites where this has an effect on font selection.
parent 884c05a6
......@@ -508,7 +508,9 @@ function locale_initialize() {
$languages = $languages['name'];
}
else {
$languages = array();
// Ensure the locale/language is correctly returned, even without locale.module.
// Useful for e.g. XML/HTML 'lang' attributes.
$languages = array('en' => 'English');
}
if ($user->uid && $languages[$user->language]) {
return $user->language;
......
......@@ -993,8 +993,7 @@ function node_block($op = 'list', $delta = 0) {
* The link should be an absolute URL.
*/
function node_feed($nodes = 0, $channel = array()) {
global $base_url;
$languages = (function_exists('locale')) ? locale_supported_languages() : array('name' => array());
global $base_url, $locale;
if (!$nodes) {
$nodes = db_query_range('SELECT nid FROM {node} WHERE promote = 1 AND status = 1 ORDER BY created DESC', 0, 15);
......@@ -1012,7 +1011,7 @@ function node_feed($nodes = 0, $channel = array()) {
'title' => variable_get('site_name', 'drupal') .' - '. variable_get('site_slogan', ''),
'link' => $base_url,
'description' => variable_get('site_mission', ''),
'language' => (($key = reset(array_keys($languages['name']))) ? $key : 'en')
'language' => $locale
);
$channel = array_merge($channel_defaults, $channel);
......
......@@ -993,8 +993,7 @@ function node_block($op = 'list', $delta = 0) {
* The link should be an absolute URL.
*/
function node_feed($nodes = 0, $channel = array()) {
global $base_url;
$languages = (function_exists('locale')) ? locale_supported_languages() : array('name' => array());
global $base_url, $locale;
if (!$nodes) {
$nodes = db_query_range('SELECT nid FROM {node} WHERE promote = 1 AND status = 1 ORDER BY created DESC', 0, 15);
......@@ -1012,7 +1011,7 @@ function node_feed($nodes = 0, $channel = array()) {
'title' => variable_get('site_name', 'drupal') .' - '. variable_get('site_slogan', ''),
'link' => $base_url,
'description' => variable_get('site_mission', ''),
'language' => (($key = reset(array_keys($languages['name']))) ? $key : 'en')
'language' => $locale
);
$channel = array_merge($channel_defaults, $channel);
......
<!-- BEGIN: header --><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{language}" xml:lang="{language}">
<head>
<title>{head_title}</title>
......
......@@ -24,8 +24,10 @@ function chameleon_page($content, $title = NULL, $breadcrumb = NULL) {
drupal_set_breadcrumb($breadcrumb);
}
$language = $GLOBALS['locale'];
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n";
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"$language\" xml:lang=\"$language\">\n";
$output .= "<head>\n";
$output .= " <title>". ($title ? $title ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")) ."</title>\n";
$output .= drupal_get_html_head();
......
......@@ -120,6 +120,7 @@ function xtemplate_page($content, $title = NULL, $breadcrumb = NULL) {
global $xtemplate;
$xtemplate->template->assign(array(
"language" => $GLOBALS['locale'],
"head_title" => (drupal_get_title() ? drupal_get_title() ." | ". variable_get("site_name", "drupal") : variable_get("site_name", "drupal") ." | ". variable_get("site_slogan", "")),
"head" => drupal_get_html_head(),
"styles" => theme_get_styles(),
......
<!-- BEGIN: header --><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" lang="{language}" xml:lang="{language}">
<head>
<title>{head_title}</title>
{head}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment