@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user