1 install.core.inc | install_get_available_translations($files) |
Provide a list of available translation files.
Return value
array: An array of language codes.
File
- core/
includes/ install.core.inc, line 1462 - API functions for installing Backdrop.
Code
function install_get_available_translations($files) {
$available_translations = array();
$response = backdrop_http_request(INSTALL_AVAILABLE_TRANSLATIONS_URI, array(
'timeout' => 5,
));
$data = array();
if ($response->code === '200') {
$data = json_decode($response->data, TRUE);
}
if ($data) {
$available_translations = array_keys($data);
}
elseif (count($files) > 1) {
foreach ($files as $translation_file) {
$available_translations[] = $translation_file->langcode;
}
}
// English is always available.
$available_translations[] = 'en';
$standard_languages = standard_language_list();
return array_intersect_key($standard_languages, array_flip(array_unique($available_translations)));
}