diff --git a/core/modules/locale/lib/Drupal/locale/PoDatabaseWriter.php b/core/modules/locale/lib/Drupal/locale/PoDatabaseWriter.php
index eb02890..4c8b254 100644
--- a/core/modules/locale/lib/Drupal/locale/PoDatabaseWriter.php
+++ b/core/modules/locale/lib/Drupal/locale/PoDatabaseWriter.php
@@ -102,7 +102,6 @@ function setReport($report = array()) {
'updates' => 0,
'deletes' => 0,
'skips' => 0,
- 'strings' => array(),
);
$this->_report = $report;
}
@@ -259,7 +258,6 @@ private function importString(PoItem $item) {
$string->save();
$this->_report['updates']++;
}
- $this->_report['strings'][] = $string->getId();
return $string->lid;
}
else {
@@ -274,7 +272,6 @@ private function importString(PoItem $item) {
))->save();
$this->_report['additions']++;
- $this->_report['strings'][] = $string->getId();
return $string->lid;
}
}
@@ -282,7 +279,6 @@ private function importString(PoItem $item) {
// Empty translation, remove existing if instructed.
$string->delete();
$this->_report['deletes']++;
- $this->_report['strings'][] = $string->lid;
return $string->lid;
}
}
diff --git a/core/modules/locale/locale.bulk.inc b/core/modules/locale/locale.bulk.inc
index 64d2c55..5420ac9 100644
--- a/core/modules/locale/locale.bulk.inc
+++ b/core/modules/locale/locale.bulk.inc
@@ -543,7 +543,7 @@ function locale_translate_batch_import_save($context) {
function locale_translate_batch_finished($success, $results) {
if ($success) {
$additions = $updates = $deletes = $skips = 0;
- $strings = $langcodes = array();
+ $langcodes = array();
if (isset($results['failed_files'])) {
if (module_exists('dblog')) {
$message = format_plural(count($results['failed_files']), 'One translation file could not be imported. See the log for details.', '@count translation files could not be imported. See the log for details.', array('@url' => url('admin/reports/dblog')));
@@ -566,10 +566,8 @@ function locale_translate_batch_finished($success, $results) {
if ($report['skips'] > 0) {
$skipped_files[] = $filepath;
}
- $strings = array_merge($strings, $report['strings']);
}
- // Get list of unique string identifiers and language codes updated.
- $strings = array_unique($strings);
+ // Get list of unique language codes updated.
$langcodes = array_unique(array_values($results['languages']));
}
drupal_set_message(format_plural(count($results['files']),
@@ -590,10 +588,8 @@ function locale_translate_batch_finished($success, $results) {
watchdog('locale', '@count disallowed HTML string(s) in files: @files.', array('@count' => $skips, '@files' => implode(',', $skipped_files)), WATCHDOG_WARNING);
}
- if ($strings) {
- // Clear cache and force refresh of JavaScript translations.
- _locale_refresh_translations($langcodes, $strings);
- }
+ // Clear cache and force refresh of JavaScript translations.
+ _locale_refresh_translations($langcodes);
}
}
}
diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module
index c8ccc37..ce226bb 100644
--- a/core/modules/locale/locale.module
+++ b/core/modules/locale/locale.module
@@ -1028,12 +1028,14 @@ function locale_string_is_safe($string) {
* @param array $langcodes
* Language codes for updated translations.
* @param array $lids
- * List of string identifiers that have been updated / created.
+ * (optional) List of string identifiers that have been updated / created.
+ * If not provided, all caches for the affected languages are cleared.
*/
-function _locale_refresh_translations($langcodes, $lids) {
- if ($lids && $langcodes) {
- // Update javascript translations if any of the strings has a javascript location.
- if ($strings = locale_storage()->getStrings(array('lid' => $lids, 'type' => 'javascript'))) {
+function _locale_refresh_translations($langcodes, $lids = array()) {
+ if (!empty($langcodes)) {
+ // Update javascript translations if any of the strings has a javascript
+ // location, or if no string ids were provided, update all languages.
+ if (empty($lids) || ($strings = locale_storage()->getStrings(array('lid' => $lids, 'type' => 'javascript')))) {
array_map('_locale_invalidate_js', $langcodes);
}
}