summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-09-01 22:09:20 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2012-09-01 22:09:43 -0700
commite5c59875a4147f11403daee2c1a2b2d8709e0418 (patch)
tree0a354841d5a3e67caa02fac4b979ed3cbb4f9738
parentae3e7b82309aa797383e10a2479d5b69e9f8fd98 (diff)
downloadbrdo-e5c59875a4147f11403daee2c1a2b2d8709e0418.tar.gz
brdo-e5c59875a4147f11403daee2c1a2b2d8709e0418.tar.bz2
Issue #1164682 by mgifford, good_man, mvc, clemens.tolboom, sxnc, lazysoundsystem: Fixed Switch language links need language identifier.
-rw-r--r--includes/language.inc11
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);