function drush_l10n_update in Localization update 7
Same name and namespace in other branches
- 6 l10n_update.drush.inc \drush_l10n_update()
- 7.2 l10n_update.drush.inc \drush_l10n_update()
Callback for command l10n-update.
File
- ./
l10n_update.drush.inc, line 113 - Drush interface to l10n-update functionalities.
Code
function drush_l10n_update() {
$updates = _drush_l10n_update_get_updates();
if (!is_null($updates)) {
if (count($updates) > 0) {
drush_log(dt('Found @count projects to update.', array(
'@count' => count($updates),
)), 'status');
// Batch update all projects for selected languages.
$mode = drush_get_option('mode', 'keep');
switch ($mode) {
case 'keep':
$mode = LOCALE_IMPORT_KEEP;
break;
case 'replace':
$mode = LOCALE_UPDATE_OVERRIDE_DEFAULT;
break;
case 'overwrite':
$mode = LOCALE_IMPORT_OVERWRITE;
break;
default:
return drush_set_error('L10N_UPDATE_INVALID_MODE', dt('Invalid update mode. Valid options are keep, overwrite.'));
break;
}
$languages = drush_get_option('languages');
module_load_include('batch.inc', 'l10n_update');
$updates = _l10n_update_prepare_updates($updates, NULL, array_keys($languages));
$batch = l10n_update_batch_multiple($updates, $mode);
drush_log($batch['title'], 'status');
drush_log($batch['init_message'], 'status');
batch_set($batch);
drush_backend_batch_process();
}
else {
drush_log(dt('All translations up to date'), 'status');
}
}
}