1 locale.install locale_update_1004()

Update locale settings to config.

Related topics

File

core/modules/locale/locale.install, line 324
Install, update and uninstall functions for the locale module.

Code

function locale_update_1004() {
  $config = config('locale.settings');

  // Previously we had stored these settings in language.negotiation config, so
  // move them if they exist.
  $old_config = config('language.negotiation');
  if (!$old_config->isNew()) {
    $config->set('language_negotiation_session_parameter', $old_config->get('session_parameter'));
    $config->set('language_negotiation_url_part', $old_config->get('url_part'));
    $config->set('language_negotiation_url_prefixes', $old_config->get('url_prefixes'));
    $config->set('language_negotiation_url_domains', $old_config->get('url_domains'));
    $old_config->delete();
  }

  $config->set('language_negotiation_url_type', update_variable_get('locale_language_negotiation_url_type', 'language'));
  $config->set('language_providers_weight_language', update_variable_get('locale_language_providers_weight_language'));
  $config->set('cache_length', update_variable_get('locale_cache_length', 75));
  $config->set('field_language_fallback', update_variable_get('locale_field_language_fallback', TRUE));
  $config->set('translate_english', update_variable_get('locale_translate_english', FALSE));

  $config->save();

  // Moved to config:
  update_variable_del('locale_language_negotiation_url_type');
  update_variable_del('locale_language_providers_weight_language');
  update_variable_del('locale_cache_length');
  update_variable_del('locale_field_language_fallback');
  update_variable_del('locale_translate_english');

  // Moved to $settings:
  update_variable_del('locale_translate_file_directory');
  update_variable_del('locale_js_directory');
  update_variable_del('locale_cache_strings');

  // Moved to state:
  update_variable_del('locale_translation_javascript');
}