7.x install.core.inc install_import_locales(&$install_state)

Imports languages via a batch process during installation.

Parameters

$install_state: An array of information about the current installation state.

Return value

The batch definition, if there are language files to import.

File

includes/install.core.inc, line 1460
API functions for installing Drupal.

Code

function install_import_locales(&$install_state) {
  include_once DRUPAL_ROOT . '/includes/locale.inc';
  $install_locale = $install_state['parameters']['locale'];
  include_once DRUPAL_ROOT . '/includes/iso.inc';
  $predefined = _locale_get_predefined_list();
  if (!isset($predefined[$install_locale])) {

    // Drupal does not know about this language, so we prefill its values with
    // our best guess. The user will be able to edit afterwards.
    locale_add_language($install_locale, $install_locale, $install_locale, LANGUAGE_LTR, '', '', TRUE, TRUE);
  }
  else {

    // A known predefined language, details will be filled in properly.
    locale_add_language($install_locale, NULL, NULL, NULL, '', '', TRUE, TRUE);
  }

  // Collect files to import for this language.
  $batch = locale_batch_by_language($install_locale, NULL);
  if (!empty($batch)) {

    // Remember components we cover in this batch set.
    variable_set('install_locale_batch_components', $batch['#components']);
    return $batch;
  }
}