summaryrefslogtreecommitdiff
path: root/includes/language.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/language.inc')
-rw-r--r--includes/language.inc17
1 files changed, 14 insertions, 3 deletions
diff --git a/includes/language.inc b/includes/language.inc
index 20909f5a6..d0ea83113 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);
@@ -408,7 +419,7 @@ function language_from_default() {
}
/**
- * Split the given path into prefix and actual path.
+ * Splits the given path into prefix and actual path.
*
* Parse the given path and return the language object identified by the
* prefix and the actual path.
@@ -440,10 +451,10 @@ function language_url_split_prefix($path, $languages) {
}
/**
- * Return the possible fallback languages ordered by language weight.
+ * Returns the possible fallback languages ordered by language weight.
*
* @param
- * The language type.
+ * (optional) The language type. Defaults to LANGUAGE_TYPE_CONTENT.
*
* @return
* An array of language codes.