function l10n_update_batch_finished in Localization update 7.2
Finished callback of system page locale import batch.
1 call to l10n_update_batch_finished()
- l10n_update_batch_fetch_finished in ./
l10n_update.batch.inc - Batch finished callback: Set result message.
1 string reference to 'l10n_update_batch_finished'
- l10n_update_batch_build in ./
l10n_update.bulk.inc - Build a locale batch from an array of files.
File
- ./
l10n_update.bulk.inc, line 587 - Mass import-export and batch import functionality for Gettext .po files.
Code
function l10n_update_batch_finished($success, $results) {
if ($success) {
$additions = $updates = $deletes = $skips = $config = 0;
if (isset($results['failed_files'])) {
if (module_exists('dblog')) {
$message = format_plural(count($results['failed_files']), 'One translation file could not be imported. <a href="@url">See the log</a> for details.', '@count translation files could not be imported. <a href="@url">See the log</a> for details.', array(
'@url' => url('admin/reports/dblog'),
));
}
else {
$message = format_plural(count($results['failed_files']), 'One translation files could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.');
}
drupal_set_message($message, 'error');
}
if (isset($results['files'])) {
$skipped_files = array();
// If there are no results and/or no stats (eg. coping with an empty .po
// file), simply do nothing.
if ($results && isset($results['stats'])) {
foreach ($results['stats'] as $filepath => $report) {
$additions += $report['additions'];
$updates += $report['updates'];
$deletes += $report['deletes'];
$skips += $report['skips'];
if ($report['skips'] > 0) {
$skipped_files[] = $filepath;
}
}
}
drupal_set_message(format_plural(count($results['files']), 'One translation file imported. %number translations were added, %update translations were updated and %delete translations were removed.', '@count translation files imported. %number translations were added, %update translations were updated and %delete translations were removed.', array(
'%number' => $additions,
'%update' => $updates,
'%delete' => $deletes,
)));
watchdog('l10n_update', 'Translations imported: %number added, %update updated, %delete removed.', array(
'%number' => $additions,
'%update' => $updates,
'%delete' => $deletes,
));
if ($skips) {
if (module_exists('dblog')) {
$message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', '@count translation strings were skipped because of disallowed or malformed HTML. <a href="@url">See the log</a> for details.', array(
'@url' => url('admin/reports/dblog'),
));
}
else {
$message = format_plural($skips, 'One translation string was skipped because of disallowed or malformed HTML. See the log for details.', '@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.');
}
drupal_set_message($message, 'warning');
watchdog('l10n_update', '@count disallowed HTML string(s) in files: @files.', array(
'@count' => $skips,
'@files' => implode(',', $skipped_files),
), WATCHDOG_WARNING);
}
}
}
}