diff options
-rw-r--r-- | includes/language.inc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/includes/language.inc b/includes/language.inc index 20909f5a6..c530c2a65 100644 --- a/includes/language.inc +++ b/includes/language.inc @@ -190,6 +190,11 @@ function language_negotiation_get_switch_links($type, $path) { $links = FALSE; $negotiation = variable_get("language_negotiation_$type", array()); + // Only get the languages if we have more than one. + if (count(language_list()) >= 2) { + $language = language_initialize($type); + } + foreach ($negotiation as $id => $provider) { if (isset($provider['callbacks']['switcher'])) { if (isset($provider['file'])) { @@ -199,6 +204,12 @@ function language_negotiation_get_switch_links($type, $path) { $callback = $provider['callbacks']['switcher']; $result = $callback($type, $path); + // Add support for WCAG 2.0's Language of Parts to add language identifiers. + // http://www.w3.org/TR/UNDERSTANDING-WCAG20/meaning-other-lang-id.html + foreach ($result as $langcode => $link) { + $result[$langcode]['attributes']['lang'] = $langcode; + } + if (!empty($result)) { // Allow modules to provide translations for specific links. drupal_alter('language_switch_links', $result, $type, $path); |