You are here

function i18n_string_install in Internationalization 7

Implements hook_install().

File

i18n_string/i18n_string.install, line 20
Installation file for i18n_string module.

Code

function i18n_string_install() {

  // Add a field to track whether a translation needs updating.
  module_load_install('i18n');
  i18n_install_create_fields('locales_target', array(
    'i18n_status',
  ));

  // Set module weight for it to run after core modules.
  db_query("UPDATE {system} SET weight = 10 WHERE name = 'i18n_string' AND type = 'module'");

  // If updating from D6, module changed name
  if (variable_get('i18n_drupal6_update')) {
    i18n_string_update_7000();
    i18n_string_update_7001();
  }

  // Create new index in {locales_source}, performance improvement in sites with i18n.
  if (!db_index_exists('locales_source', 'textgroup_context')) {
    db_add_index('locales_source', 'textgroup_context', array(
      'textgroup',
      array(
        'context',
        50,
      ),
    ));
  }
}