diff --git a/core/includes/language.inc b/core/includes/language.inc index 4628053..6263f09 100644 --- a/core/includes/language.inc +++ b/core/includes/language.inc @@ -199,6 +199,14 @@ function language_negotiation_get_switch_links($type, $path) { $callback = $provider['callbacks']['switcher']; $result = $callback($type, $path); + // Add language specific CSS class as well as 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']['class'][] = 'language-link-' . $langcode; + $result[$langcode]['attributes']['lang'] = $langcode; + } + if (!empty($result)) { // Allow modules to provide translations for specific links. drupal_alter('language_switch_links', $result, $type, $path); diff --git a/core/modules/locale/locale.test b/core/modules/locale/locale.test index f102d4b..431b9ce 100644 --- a/core/modules/locale/locale.test +++ b/core/modules/locale/locale.test @@ -2205,7 +2205,7 @@ class LocaleUILanguageNegotiationTest extends DrupalWebTestCase { // Check that the language switcher active link matches the given browser // language. $args = array(':url' => base_path() . (!empty($GLOBALS['conf']['clean_url']) ? $langcode_browser_fallback : "?q=$langcode_browser_fallback")); - $fields = $this->xpath('//div[@id="block-locale-language"]//a[@class="language-link active" and @href=:url]', $args); + $fields = $this->xpath('//div[@id="block-locale-language"]//a[@class="language-link language-link-it active" and @href=:url]', $args); $this->assertTrue($fields[0] == $languages[$langcode_browser_fallback]->name, t('The browser language is the URL active language')); // Check that URLs are rewritten using the given browser language. @@ -2391,7 +2391,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { $this->assertRaw($body_value, t('Body correctly displayed using English as requested language')); } - /* + /** * Test multilingual field display settings. */ function testMultilingualDisplaySettings() {