install_import_locales

function install_import_locales

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;
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!install.core.inc/function/install_import_locales/7.x

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部