Révision 503b3f7b
Ajouté par Assos Assos il y a environ 10 ans
drupal7/sites/all/modules/l10n_update/l10n_update.drush.inc | ||
---|---|---|
23 | 23 |
'description' => 'Update translations.', |
24 | 24 |
'options' => array( |
25 | 25 |
'languages' => 'Comma separated list of languages. Defaults to all available languages.', |
26 |
'mode' => 'Allowed values: overwrite, keep. Default value: keep.'
|
|
26 |
'mode' => 'Determine if existing translations are overwitten during import. Use "overwrite" to overwrite any existing translation, "replace" to replace previously imported translations but not overwrite edited strings, "keep" to keep any existing translation and only add new translations. Default value: keep'
|
|
27 | 27 |
), |
28 | 28 |
); |
29 | 29 |
return $commands; |
... | ... | |
102 | 102 |
|
103 | 103 |
// Check provided update mode is valid. |
104 | 104 |
$mode = drush_get_option('mode', 'keep'); |
105 |
if (!in_array($mode, array('keep', 'overwrite'))) { |
|
106 |
return drush_set_error('L10N_UPDATE_INVALID_MODE', dt('Invalid update mode. Valid options are keep, overwrite.')); |
|
105 |
if (!in_array($mode, array('keep', 'replace', 'overwrite'))) {
|
|
106 |
return drush_set_error('L10N_UPDATE_INVALID_MODE', dt('Invalid update mode. Valid options are keep, replace, overwrite.'));
|
|
107 | 107 |
} |
108 | 108 |
} |
109 | 109 |
|
... | ... | |
118 | 118 |
|
119 | 119 |
// Batch update all projects for selected languages. |
120 | 120 |
$mode = drush_get_option('mode', 'keep'); |
121 |
|
|
122 |
switch ($mode) { |
|
123 |
case 'keep': |
|
124 |
$mode = LOCALE_IMPORT_KEEP; |
|
125 |
break; |
|
126 |
case 'replace': |
|
127 |
$mode = LOCALE_UPDATE_OVERRIDE_DEFAULT; |
|
128 |
break; |
|
129 |
case 'overwrite': |
|
130 |
$mode = LOCALE_IMPORT_OVERWRITE; |
|
131 |
break; |
|
132 |
|
|
133 |
default: |
|
134 |
return drush_set_error('L10N_UPDATE_INVALID_MODE', dt('Invalid update mode. Valid options are keep, overwrite.')); |
|
135 |
break; |
|
136 |
} |
|
137 |
|
|
121 | 138 |
$languages = drush_get_option('languages'); |
122 | 139 |
module_load_include('batch.inc', 'l10n_update'); |
123 | 140 |
$updates = _l10n_update_prepare_updates($updates, NULL, array_keys($languages)); |
Formats disponibles : Unified diff
Weekly update of contrib modules