1 install.core.inc | install_import_translations(&$install_state) |
Imports languages via a batch process during installation.
Parameters
array $install_state: An array of information about the current installation state.
Return value
array|NULL: The batch definition, if there are language files to import.
File
- core/
includes/ install.core.inc, line 1978 - API functions for installing Backdrop.
Code
function install_import_translations(&$install_state) {
include_once BACKDROP_ROOT . '/core/includes/locale.inc';
include_once backdrop_get_path('module', 'locale') . '/locale.bulk.inc';
$langcode = $install_state['parameters']['langcode'];
include_once BACKDROP_ROOT . '/core/includes/standard.inc';
module_enable(array('language', 'locale'));
$standard_languages = standard_language_list();
if (!isset($standard_languages[$langcode])) {
// Backdrop does not know about this language, so we prefill its values with
// our best guess. If required, this can be edited post-installation.
$language = (object) array(
'langcode' => $langcode,
'name' => $langcode,
'native' => $langcode,
'default' => TRUE,
);
language_save($language);
}
else {
// A known predefined language, details will be filled in properly.
$language = (object) array(
'langcode' => $langcode,
'default' => TRUE,
);
language_save($language);
}
// Collect files to import for this language.
$batch = locale_translate_batch_import_files($langcode);
if (!empty($batch)) {
return $batch;
}
// No active batch.
return NULL;
}