| 
webmaster@1
 | 
     1 <?php | 
| 
webmaster@1
 | 
     2 // $Id: locale.install,v 1.27 2008/01/10 14:35:24 goba Exp $ | 
| 
webmaster@1
 | 
     3  | 
| 
webmaster@1
 | 
     4 /** | 
| 
webmaster@1
 | 
     5  * Implementation of hook_install(). | 
| 
webmaster@1
 | 
     6  */ | 
| 
webmaster@1
 | 
     7 function locale_install() { | 
| 
webmaster@1
 | 
     8   // locales_source.source and locales_target.target are not used as binary | 
| 
webmaster@1
 | 
     9   // fields; non-MySQL database servers need to ensure the field type is text | 
| 
webmaster@1
 | 
    10   // and that LIKE produces a case-sensitive comparison. | 
| 
webmaster@1
 | 
    11  | 
| 
webmaster@1
 | 
    12   // Create tables. | 
| 
webmaster@1
 | 
    13   drupal_install_schema('locale'); | 
| 
webmaster@1
 | 
    14  | 
| 
webmaster@1
 | 
    15   db_query("INSERT INTO {languages} (language, name, native, direction, enabled, weight, javascript) VALUES ('en', 'English', 'English', '0', '1', '0', '')"); | 
| 
webmaster@1
 | 
    16 } | 
| 
webmaster@1
 | 
    17  | 
| 
webmaster@1
 | 
    18 /** | 
| 
webmaster@1
 | 
    19  * @defgroup updates-5.x-to-6.x Locale updates from 5.x to 6.x | 
| 
webmaster@1
 | 
    20  * @{ | 
| 
webmaster@1
 | 
    21  */ | 
| 
webmaster@1
 | 
    22  | 
| 
webmaster@1
 | 
    23 /** | 
| 
webmaster@1
 | 
    24  * {locales_meta} table became {languages}. | 
| 
webmaster@1
 | 
    25  */ | 
| 
webmaster@1
 | 
    26 function locale_update_6000() { | 
| 
webmaster@1
 | 
    27   $ret = array(); | 
| 
webmaster@1
 | 
    28  | 
| 
webmaster@1
 | 
    29   $schema['languages'] = array( | 
| 
webmaster@1
 | 
    30     'fields' => array( | 
| 
webmaster@1
 | 
    31       'language' => array( | 
| 
webmaster@1
 | 
    32         'type' => 'varchar', | 
| 
webmaster@1
 | 
    33         'length' => 12, | 
| 
webmaster@1
 | 
    34         'not null' => TRUE, | 
| 
webmaster@1
 | 
    35         'default' => '', | 
| 
webmaster@1
 | 
    36       ), | 
| 
webmaster@1
 | 
    37       'name' => array( | 
| 
webmaster@1
 | 
    38         'type' => 'varchar', | 
| 
webmaster@1
 | 
    39         'length' => 64, | 
| 
webmaster@1
 | 
    40         'not null' => TRUE, | 
| 
webmaster@1
 | 
    41         'default' => '', | 
| 
webmaster@1
 | 
    42       ), | 
| 
webmaster@1
 | 
    43       'native' => array( | 
| 
webmaster@1
 | 
    44         'type' => 'varchar', | 
| 
webmaster@1
 | 
    45         'length' => 64, | 
| 
webmaster@1
 | 
    46         'not null' => TRUE, | 
| 
webmaster@1
 | 
    47         'default' => '', | 
| 
webmaster@1
 | 
    48       ), | 
| 
webmaster@1
 | 
    49       'direction' => array( | 
| 
webmaster@1
 | 
    50         'type' => 'int', | 
| 
webmaster@1
 | 
    51         'not null' => TRUE, | 
| 
webmaster@1
 | 
    52         'default' => 0, | 
| 
webmaster@1
 | 
    53       ), | 
| 
webmaster@1
 | 
    54       'enabled' => array( | 
| 
webmaster@1
 | 
    55         'type' => 'int', | 
| 
webmaster@1
 | 
    56         'not null' => TRUE, | 
| 
webmaster@1
 | 
    57         'default' => 0, | 
| 
webmaster@1
 | 
    58       ), | 
| 
webmaster@1
 | 
    59       'plurals' => array( | 
| 
webmaster@1
 | 
    60         'type' => 'int', | 
| 
webmaster@1
 | 
    61         'not null' => TRUE, | 
| 
webmaster@1
 | 
    62         'default' => 0, | 
| 
webmaster@1
 | 
    63       ), | 
| 
webmaster@1
 | 
    64       'formula' => array( | 
| 
webmaster@1
 | 
    65         'type' => 'varchar', | 
| 
webmaster@1
 | 
    66         'length' => 128, | 
| 
webmaster@1
 | 
    67         'not null' => TRUE, | 
| 
webmaster@1
 | 
    68         'default' => '', | 
| 
webmaster@1
 | 
    69       ), | 
| 
webmaster@1
 | 
    70       'domain' => array( | 
| 
webmaster@1
 | 
    71         'type' => 'varchar', | 
| 
webmaster@1
 | 
    72         'length' => 128, | 
| 
webmaster@1
 | 
    73         'not null' => TRUE, | 
| 
webmaster@1
 | 
    74         'default' => '', | 
| 
webmaster@1
 | 
    75       ), | 
| 
webmaster@1
 | 
    76       'prefix' => array( | 
| 
webmaster@1
 | 
    77         'type' => 'varchar', | 
| 
webmaster@1
 | 
    78         'length' => 128, | 
| 
webmaster@1
 | 
    79         'not null' => TRUE, | 
| 
webmaster@1
 | 
    80         'default' => '', | 
| 
webmaster@1
 | 
    81       ), | 
| 
webmaster@1
 | 
    82       'weight' => array( | 
| 
webmaster@1
 | 
    83         'type' => 'int', | 
| 
webmaster@1
 | 
    84         'not null' => TRUE, | 
| 
webmaster@1
 | 
    85         'default' => 0, | 
| 
webmaster@1
 | 
    86       ), | 
| 
webmaster@1
 | 
    87       'javascript' => array( //Adds a column to store the filename of the JavaScript translation file. | 
| 
webmaster@1
 | 
    88         'type' => 'varchar', | 
| 
webmaster@1
 | 
    89         'length' => 32, | 
| 
webmaster@1
 | 
    90         'not null' => TRUE, | 
| 
webmaster@1
 | 
    91         'default' => '', | 
| 
webmaster@1
 | 
    92       ), | 
| 
webmaster@1
 | 
    93     ), | 
| 
webmaster@1
 | 
    94     'primary key' => array('language'), | 
| 
webmaster@1
 | 
    95     'indexes' => array( | 
| 
webmaster@1
 | 
    96       'list' => array('weight', 'name'), | 
| 
webmaster@1
 | 
    97     ), | 
| 
webmaster@1
 | 
    98   ); | 
| 
webmaster@1
 | 
    99  | 
| 
webmaster@1
 | 
   100   db_create_table($ret, 'languages', $schema['languages']); | 
| 
webmaster@1
 | 
   101  | 
| 
webmaster@1
 | 
   102   // Save the languages | 
| 
webmaster@1
 | 
   103   $ret[] = update_sql("INSERT INTO {languages} (language, name, native, direction, enabled, plurals, formula, domain, prefix, weight) SELECT locale, name, name, 0, enabled, plurals, formula, '', locale, 0 FROM {locales_meta}"); | 
| 
webmaster@1
 | 
   104  | 
| 
webmaster@1
 | 
   105   // Save the language count in the variable table | 
| 
webmaster@1
 | 
   106   $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1')); | 
| 
webmaster@1
 | 
   107   variable_set('language_count', $count); | 
| 
webmaster@1
 | 
   108  | 
| 
webmaster@1
 | 
   109   // Save the default language in the variable table | 
| 
webmaster@1
 | 
   110   $default = db_fetch_object(db_query('SELECT * FROM {locales_meta} WHERE isdefault = 1')); | 
| 
webmaster@1
 | 
   111   variable_set('language_default', (object) array('language' => $default->locale, 'name' => $default->name, 'native' => '', 'direction' => 0, 'enabled' => 1, 'plurals' => $default->plurals, 'formula' => $default->formula, 'domain' => '', 'prefix' => $default->locale, 'weight' => 0)); | 
| 
webmaster@1
 | 
   112  | 
| 
webmaster@1
 | 
   113   $ret[] = update_sql("DROP TABLE {locales_meta}"); | 
| 
webmaster@1
 | 
   114   return $ret; | 
| 
webmaster@1
 | 
   115 } | 
| 
webmaster@1
 | 
   116  | 
| 
webmaster@1
 | 
   117 /** | 
| 
webmaster@1
 | 
   118  * Change locale column to language. The language column is added by | 
| 
webmaster@1
 | 
   119  * update_fix_d6_requirements() in update.php to avoid a large number | 
| 
webmaster@1
 | 
   120  * of error messages from update.php.  All we need to do here is copy | 
| 
webmaster@1
 | 
   121  * locale to language and then drop locale. | 
| 
webmaster@1
 | 
   122  */ | 
| 
webmaster@1
 | 
   123 function locale_update_6001() { | 
| 
webmaster@1
 | 
   124   $ret = array(); | 
| 
webmaster@1
 | 
   125   $ret[] = update_sql('UPDATE {locales_target} SET language = locale'); | 
| 
webmaster@1
 | 
   126   db_drop_field($ret, 'locales_target', 'locale'); | 
| 
webmaster@1
 | 
   127   return $ret; | 
| 
webmaster@1
 | 
   128 } | 
| 
webmaster@1
 | 
   129  | 
| 
webmaster@1
 | 
   130 /** | 
| 
webmaster@1
 | 
   131  * Remove empty translations, we don't need these anymore. | 
| 
webmaster@1
 | 
   132  */ | 
| 
webmaster@1
 | 
   133 function locale_update_6002() { | 
| 
webmaster@1
 | 
   134   $ret = array(); | 
| 
webmaster@1
 | 
   135   $ret[] = update_sql("DELETE FROM {locales_target} WHERE translation = ''"); | 
| 
webmaster@1
 | 
   136   return $ret; | 
| 
webmaster@1
 | 
   137 } | 
| 
webmaster@1
 | 
   138  | 
| 
webmaster@1
 | 
   139 /** | 
| 
webmaster@1
 | 
   140  * Prune strings with no translations (will be automatically re-registered if still in use) | 
| 
webmaster@1
 | 
   141  */ | 
| 
webmaster@1
 | 
   142 function locale_update_6003() { | 
| 
webmaster@1
 | 
   143   $ret = array(); | 
| 
webmaster@1
 | 
   144   $ret[] = update_sql("DELETE FROM {locales_source} WHERE lid NOT IN (SELECT lid FROM {locales_target})"); | 
| 
webmaster@1
 | 
   145   return $ret; | 
| 
webmaster@1
 | 
   146 } | 
| 
webmaster@1
 | 
   147  | 
| 
webmaster@1
 | 
   148 /** | 
| 
webmaster@1
 | 
   149  * Fix remaining inconsistent indexes. | 
| 
webmaster@1
 | 
   150  */ | 
| 
webmaster@1
 | 
   151 function locale_update_6004() { | 
| 
webmaster@1
 | 
   152   $ret = array(); | 
| 
webmaster@1
 | 
   153   db_add_index($ret, 'locales_target', 'language', array('language')); | 
| 
webmaster@1
 | 
   154  | 
| 
webmaster@1
 | 
   155   switch ($GLOBALS['db_type']) { | 
| 
webmaster@1
 | 
   156     case 'pgsql': | 
| 
webmaster@1
 | 
   157       db_drop_index($ret, 'locales_source', 'source'); | 
| 
webmaster@1
 | 
   158       db_add_index($ret, 'locales_source', 'source', array(array('source', 30))); | 
| 
webmaster@1
 | 
   159       break; | 
| 
webmaster@1
 | 
   160   } | 
| 
webmaster@1
 | 
   161  | 
| 
webmaster@1
 | 
   162   return $ret; | 
| 
webmaster@1
 | 
   163 } | 
| 
webmaster@1
 | 
   164  | 
| 
webmaster@1
 | 
   165 /** | 
| 
webmaster@1
 | 
   166  * Change language setting variable of content types. | 
| 
webmaster@1
 | 
   167  *  | 
| 
webmaster@1
 | 
   168  * Use language_content_type_<content_type> instead of language_<content_type> | 
| 
webmaster@1
 | 
   169  * so content types such as 'default', 'count' or 'negotiation' will not | 
| 
webmaster@1
 | 
   170  * interfere with language variables. | 
| 
webmaster@1
 | 
   171  */ | 
| 
webmaster@1
 | 
   172 function locale_update_6005() { | 
| 
webmaster@1
 | 
   173   foreach (node_get_types() as $type => $content_type) { | 
| 
webmaster@1
 | 
   174     // Default to NULL, so we can skip dealing with non-existent settings. | 
| 
webmaster@1
 | 
   175     $setting = variable_get('language_'. $type, NULL); | 
| 
webmaster@1
 | 
   176     if ($type == 'default' && is_numeric($setting)) { | 
| 
webmaster@1
 | 
   177       // language_default was overwritten with the content type setting, | 
| 
webmaster@1
 | 
   178       // so reset the default language and save the content type setting. | 
| 
webmaster@1
 | 
   179       variable_set('language_content_type_default', $setting); | 
| 
webmaster@1
 | 
   180       variable_del('language_default'); | 
| 
webmaster@1
 | 
   181       drupal_set_message('The default language setting has been reset to its default value. Check the '. l('language configuration page', 'admin/settings/language') .' to configure it correctly.'); | 
| 
webmaster@1
 | 
   182     } | 
| 
webmaster@1
 | 
   183     elseif ($type == 'negotiation') { | 
| 
webmaster@1
 | 
   184       // language_content_type_negotiation is an integer either if it is | 
| 
webmaster@1
 | 
   185       // the negotiation setting or the content type setting. | 
| 
webmaster@1
 | 
   186       // The language_negotiation setting is not reset, but | 
| 
webmaster@1
 | 
   187       // the user is alerted that this setting possibly was overwritten | 
| 
webmaster@1
 | 
   188       variable_set('language_content_type_negotiation', $setting); | 
| 
webmaster@1
 | 
   189       drupal_set_message('The language negotiation setting was possibly overwritten by a content type of the same name. Check the '. l('language configuration page', 'admin/settings/language/configure') .' and the '. l('<em>'. $content_type->name ."</em> content type's multilingual support settings", 'admin/content/types/negotiation', array('html' => TRUE)) .' to configure them correctly.'); | 
| 
webmaster@1
 | 
   190     } | 
| 
webmaster@1
 | 
   191     elseif (!is_null($setting)) { | 
| 
webmaster@1
 | 
   192       // Change the language setting variable for any other content type. | 
| 
webmaster@1
 | 
   193       // Do not worry about language_count, it will be updated below. | 
| 
webmaster@1
 | 
   194       variable_set('language_content_type_'. $type, $setting); | 
| 
webmaster@1
 | 
   195       variable_del('language_'. $type); | 
| 
webmaster@1
 | 
   196     } | 
| 
webmaster@1
 | 
   197   } | 
| 
webmaster@1
 | 
   198   // Update language count variable that might be overwritten. | 
| 
webmaster@1
 | 
   199   $count = db_result(db_query('SELECT COUNT(*) FROM {languages} WHERE enabled = 1')); | 
| 
webmaster@1
 | 
   200   variable_set('language_count', $count); | 
| 
webmaster@1
 | 
   201   return array(); | 
| 
webmaster@1
 | 
   202 } | 
| 
webmaster@1
 | 
   203  | 
| 
webmaster@1
 | 
   204 /** | 
| 
webmaster@1
 | 
   205  * @} End of "defgroup updates-5.x-to-6.x" | 
| 
webmaster@1
 | 
   206  */ | 
| 
webmaster@1
 | 
   207  | 
| 
webmaster@1
 | 
   208 /** | 
| 
webmaster@1
 | 
   209  * Implementation of hook_uninstall(). | 
| 
webmaster@1
 | 
   210  */ | 
| 
webmaster@1
 | 
   211 function locale_uninstall() { | 
| 
webmaster@1
 | 
   212   // Delete all JavaScript translation files | 
| 
webmaster@1
 | 
   213   $files = db_query('SELECT javascript FROM {languages}'); | 
| 
webmaster@1
 | 
   214   while ($file = db_fetch_object($files)) { | 
| 
webmaster@1
 | 
   215     if (!empty($file)) { | 
| 
webmaster@1
 | 
   216       file_delete(file_create_path($file->javascript)); | 
| 
webmaster@1
 | 
   217     } | 
| 
webmaster@1
 | 
   218   } | 
| 
webmaster@1
 | 
   219  | 
| 
webmaster@1
 | 
   220   // Remove tables. | 
| 
webmaster@1
 | 
   221   drupal_uninstall_schema('locale'); | 
| 
webmaster@1
 | 
   222 } | 
| 
webmaster@1
 | 
   223  | 
| 
webmaster@1
 | 
   224 /** | 
| 
webmaster@1
 | 
   225  * Implementation of hook_schema(). | 
| 
webmaster@1
 | 
   226  */ | 
| 
webmaster@1
 | 
   227 function locale_schema() { | 
| 
webmaster@1
 | 
   228   $schema['languages'] = array( | 
| 
webmaster@1
 | 
   229     'description' => t('List of all available languages in the system.'), | 
| 
webmaster@1
 | 
   230     'fields' => array( | 
| 
webmaster@1
 | 
   231       'language' => array( | 
| 
webmaster@1
 | 
   232         'type' => 'varchar', | 
| 
webmaster@1
 | 
   233         'length' => 12, | 
| 
webmaster@1
 | 
   234         'not null' => TRUE, | 
| 
webmaster@1
 | 
   235         'default' => '', | 
| 
webmaster@1
 | 
   236         'description' => t("Language code, e.g. 'de' or 'en-US'."), | 
| 
webmaster@1
 | 
   237       ), | 
| 
webmaster@1
 | 
   238       'name' => array( | 
| 
webmaster@1
 | 
   239         'type' => 'varchar', | 
| 
webmaster@1
 | 
   240         'length' => 64, | 
| 
webmaster@1
 | 
   241         'not null' => TRUE, | 
| 
webmaster@1
 | 
   242         'default' => '', | 
| 
webmaster@1
 | 
   243         'description' => t('Language name in English.'), | 
| 
webmaster@1
 | 
   244       ), | 
| 
webmaster@1
 | 
   245       'native' => array( | 
| 
webmaster@1
 | 
   246         'type' => 'varchar', | 
| 
webmaster@1
 | 
   247         'length' => 64, | 
| 
webmaster@1
 | 
   248         'not null' => TRUE, | 
| 
webmaster@1
 | 
   249         'default' => '', | 
| 
webmaster@1
 | 
   250         'description' => t('Native language name.'), | 
| 
webmaster@1
 | 
   251       ), | 
| 
webmaster@1
 | 
   252       'direction' => array( | 
| 
webmaster@1
 | 
   253         'type' => 'int', | 
| 
webmaster@1
 | 
   254         'not null' => TRUE, | 
| 
webmaster@1
 | 
   255         'default' => 0, | 
| 
webmaster@1
 | 
   256         'description' => t('Direction of language (Left-to-Right = 0, Right-to-Left = 1).'), | 
| 
webmaster@1
 | 
   257       ), | 
| 
webmaster@1
 | 
   258       'enabled' => array( | 
| 
webmaster@1
 | 
   259         'type' => 'int', | 
| 
webmaster@1
 | 
   260         'not null' => TRUE, | 
| 
webmaster@1
 | 
   261         'default' => 0, | 
| 
webmaster@1
 | 
   262         'description' => t('Enabled flag (1 = Enabled, 0 = Disabled).'), | 
| 
webmaster@1
 | 
   263       ), | 
| 
webmaster@1
 | 
   264       'plurals' => array( | 
| 
webmaster@1
 | 
   265         'type' => 'int', | 
| 
webmaster@1
 | 
   266         'not null' => TRUE, | 
| 
webmaster@1
 | 
   267         'default' => 0, | 
| 
webmaster@1
 | 
   268         'description' => t('Number of plural indexes in this language.'), | 
| 
webmaster@1
 | 
   269       ), | 
| 
webmaster@1
 | 
   270       'formula' => array( | 
| 
webmaster@1
 | 
   271         'type' => 'varchar', | 
| 
webmaster@1
 | 
   272         'length' => 128, | 
| 
webmaster@1
 | 
   273         'not null' => TRUE, | 
| 
webmaster@1
 | 
   274         'default' => '', | 
| 
webmaster@1
 | 
   275         'description' => t('Plural formula in PHP code to evaluate to get plural indexes.'), | 
| 
webmaster@1
 | 
   276       ), | 
| 
webmaster@1
 | 
   277       'domain' => array( | 
| 
webmaster@1
 | 
   278         'type' => 'varchar', | 
| 
webmaster@1
 | 
   279         'length' => 128, | 
| 
webmaster@1
 | 
   280         'not null' => TRUE, | 
| 
webmaster@1
 | 
   281         'default' => '', | 
| 
webmaster@1
 | 
   282         'description' => t('Domain to use for this language.'), | 
| 
webmaster@1
 | 
   283       ), | 
| 
webmaster@1
 | 
   284       'prefix' => array( | 
| 
webmaster@1
 | 
   285         'type' => 'varchar', | 
| 
webmaster@1
 | 
   286         'length' => 128, | 
| 
webmaster@1
 | 
   287         'not null' => TRUE, | 
| 
webmaster@1
 | 
   288         'default' => '', | 
| 
webmaster@1
 | 
   289         'description' => t('Path prefix to use for this language.'), | 
| 
webmaster@1
 | 
   290       ), | 
| 
webmaster@1
 | 
   291       'weight' => array( | 
| 
webmaster@1
 | 
   292         'type' => 'int', | 
| 
webmaster@1
 | 
   293         'not null' => TRUE, | 
| 
webmaster@1
 | 
   294         'default' => 0, | 
| 
webmaster@1
 | 
   295         'description' => t('Weight, used in lists of languages.'), | 
| 
webmaster@1
 | 
   296       ), | 
| 
webmaster@1
 | 
   297       'javascript' => array( | 
| 
webmaster@1
 | 
   298         'type' => 'varchar', | 
| 
webmaster@1
 | 
   299         'length' => 32, | 
| 
webmaster@1
 | 
   300         'not null' => TRUE, | 
| 
webmaster@1
 | 
   301         'default' => '', | 
| 
webmaster@1
 | 
   302         'description' => t('Location of JavaScript translation file.'), | 
| 
webmaster@1
 | 
   303       ), | 
| 
webmaster@1
 | 
   304     ), | 
| 
webmaster@1
 | 
   305     'primary key' => array('language'), | 
| 
webmaster@1
 | 
   306     'indexes' => array( | 
| 
webmaster@1
 | 
   307       'list' => array('weight', 'name'), | 
| 
webmaster@1
 | 
   308     ), | 
| 
webmaster@1
 | 
   309   ); | 
| 
webmaster@1
 | 
   310  | 
| 
webmaster@1
 | 
   311   $schema['locales_source'] = array( | 
| 
webmaster@1
 | 
   312     'description' => t('List of English source strings.'), | 
| 
webmaster@1
 | 
   313     'fields' => array( | 
| 
webmaster@1
 | 
   314       'lid' => array( | 
| 
webmaster@1
 | 
   315         'type' => 'serial', | 
| 
webmaster@1
 | 
   316         'not null' => TRUE, | 
| 
webmaster@1
 | 
   317         'description' => t('Unique identifier of this string.'), | 
| 
webmaster@1
 | 
   318       ), | 
| 
webmaster@1
 | 
   319       'location' => array( | 
| 
webmaster@1
 | 
   320         'type' => 'varchar', | 
| 
webmaster@1
 | 
   321         'length' => 255, | 
| 
webmaster@1
 | 
   322         'not null' => TRUE, | 
| 
webmaster@1
 | 
   323         'default' => '', | 
| 
webmaster@1
 | 
   324         'description' => t('Drupal path in case of online discovered translations or file path in case of imported strings.'), | 
| 
webmaster@1
 | 
   325       ), | 
| 
webmaster@1
 | 
   326       'textgroup' => array( | 
| 
webmaster@1
 | 
   327         'type' => 'varchar', | 
| 
webmaster@1
 | 
   328         'length' => 255, | 
| 
webmaster@1
 | 
   329         'not null' => TRUE, | 
| 
webmaster@1
 | 
   330         'default' => 'default', | 
| 
webmaster@1
 | 
   331         'description' => t('A module defined group of translations, see hook_locale().'), | 
| 
webmaster@1
 | 
   332       ), | 
| 
webmaster@1
 | 
   333       'source' => array( | 
| 
webmaster@1
 | 
   334         'type' => 'text', | 
| 
webmaster@1
 | 
   335         'mysql_type' => 'blob', | 
| 
webmaster@1
 | 
   336         'not null' => TRUE, | 
| 
webmaster@1
 | 
   337         'description' => t('The original string in English.'), | 
| 
webmaster@1
 | 
   338       ), | 
| 
webmaster@1
 | 
   339       'version' => array( | 
| 
webmaster@1
 | 
   340         'type' => 'varchar', | 
| 
webmaster@1
 | 
   341         'length' => 20, | 
| 
webmaster@1
 | 
   342         'not null' => TRUE, | 
| 
webmaster@1
 | 
   343         'default' => 'none', | 
| 
webmaster@1
 | 
   344         'description' => t('Version of Drupal, where the string was last used (for locales optimization).'), | 
| 
webmaster@1
 | 
   345       ), | 
| 
webmaster@1
 | 
   346     ), | 
| 
webmaster@1
 | 
   347     'primary key' => array('lid'), | 
| 
webmaster@1
 | 
   348     'indexes' => array( | 
| 
webmaster@1
 | 
   349       'source' => array(array('source', 30)), | 
| 
webmaster@1
 | 
   350     ), | 
| 
webmaster@1
 | 
   351   ); | 
| 
webmaster@1
 | 
   352  | 
| 
webmaster@1
 | 
   353   $schema['locales_target'] = array( | 
| 
webmaster@1
 | 
   354     'description' => t('Stores translated versions of strings.'), | 
| 
webmaster@1
 | 
   355     'fields' => array( | 
| 
webmaster@1
 | 
   356       'lid' => array( | 
| 
webmaster@1
 | 
   357         'type' => 'int', | 
| 
webmaster@1
 | 
   358         'not null' => TRUE, | 
| 
webmaster@1
 | 
   359         'default' => 0, | 
| 
webmaster@1
 | 
   360         'description' => t('Source string ID. References {locales_source}.lid.'), | 
| 
webmaster@1
 | 
   361       ), | 
| 
webmaster@1
 | 
   362       'translation' => array( | 
| 
webmaster@1
 | 
   363         'type' => 'text', | 
| 
webmaster@1
 | 
   364         'mysql_type' => 'blob', | 
| 
webmaster@1
 | 
   365         'not null' => TRUE, | 
| 
webmaster@1
 | 
   366         'description' => t('Translation string value in this language.'), | 
| 
webmaster@1
 | 
   367       ), | 
| 
webmaster@1
 | 
   368       'language' => array( | 
| 
webmaster@1
 | 
   369         'type' => 'varchar', | 
| 
webmaster@1
 | 
   370         'length' => 12, | 
| 
webmaster@1
 | 
   371         'not null' => TRUE, | 
| 
webmaster@1
 | 
   372         'default' => '', | 
| 
webmaster@1
 | 
   373         'description' => t('Language code. References {languages}.language.'), | 
| 
webmaster@1
 | 
   374       ), | 
| 
webmaster@1
 | 
   375       'plid' => array( | 
| 
webmaster@1
 | 
   376         'type' => 'int', | 
| 
webmaster@1
 | 
   377         'not null' => TRUE, // This should be NULL for no referenced string, not zero. | 
| 
webmaster@1
 | 
   378         'default' => 0, | 
| 
webmaster@1
 | 
   379         'description' => t('Parent lid (lid of the previous string in the plural chain) in case of plural strings. References {locales_source}.lid.'), | 
| 
webmaster@1
 | 
   380       ), | 
| 
webmaster@1
 | 
   381       'plural' => array( | 
| 
webmaster@1
 | 
   382         'type' => 'int', | 
| 
webmaster@1
 | 
   383         'not null' => TRUE, | 
| 
webmaster@1
 | 
   384         'default' => 0, | 
| 
webmaster@1
 | 
   385         'description' => t('Plural index number in case of plural strings.'), | 
| 
webmaster@1
 | 
   386       ), | 
| 
webmaster@1
 | 
   387     ), | 
| 
webmaster@1
 | 
   388     'primary key' => array('language', 'lid', 'plural'), | 
| 
webmaster@1
 | 
   389     'indexes' => array( | 
| 
webmaster@1
 | 
   390       'lid'      => array('lid'), | 
| 
webmaster@1
 | 
   391       'plid'     => array('plid'), | 
| 
webmaster@1
 | 
   392       'plural'   => array('plural'), | 
| 
webmaster@1
 | 
   393     ), | 
| 
webmaster@1
 | 
   394   ); | 
| 
webmaster@1
 | 
   395  | 
| 
webmaster@1
 | 
   396   return $schema; | 
| 
webmaster@1
 | 
   397 } | 
| 
webmaster@1
 | 
   398  |