MDL-69788 lang: fallback to all translations if misconfigured.

If given translation list contains only invalid entries, fallback
to returning the complete list of available language translations.
This commit is contained in:
Paul Holden
2020-10-16 14:38:03 +01:00
parent 36f0c3d531
commit 252f95e1b7
2 changed files with 20 additions and 2 deletions
+13 -2
View File
@@ -533,7 +533,13 @@ class core_string_manager_standard implements core_string_manager {
$languages[$langcode] = !empty($this->transaliases[$langcode]) ? $this->transaliases[$langcode] : $langname;
}
}
return $languages;
// If there are no valid enabled translations, then return all languages.
if (!empty($languages)) {
return $languages;
} else {
return $cachedlist;
}
}
// Get all languages available in system.
@@ -584,7 +590,12 @@ class core_string_manager_standard implements core_string_manager {
}
}
return $languages;
// If there are no valid enabled translations, then return all languages.
if (!empty($languages)) {
return $languages;
} else {
return $cachedlist;
}
}
/**