diff --git a/includes/locale.inc b/includes/locale.inc
index f041659..6c4d985 100644
--- a/includes/locale.inc
+++ b/includes/locale.inc
@@ -700,8 +700,13 @@ function _locale_import_po($file, $langcode, $mode, $group = NULL) {
drupal_set_message(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => $additions, '%update' => $updates, '%delete' => $deletes)));
watchdog('locale', 'Imported %file into %locale: %number new strings added, %update updated and %delete removed.', array('%file' => $file->filename, '%locale' => $langcode, '%number' => $additions, '%update' => $updates, '%delete' => $deletes));
if ($skips) {
- $skip_message = format_plural($skips, 'One translation string was skipped because it contains disallowed HTML.', '@count translation strings were skipped because they contain disallowed HTML.');
- drupal_set_message($skip_message);
+ if (module_exists('dblog')) {
+ $skip_message = format_plural($skips, 'A 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.', array('@url' => url('admin/reports/dblog')));
+ }
+ else {
+ $skip_message = format_plural($skips, 'A 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($skip_message, 'error');
watchdog('locale', '@count disallowed HTML string(s) in %file', array('@count' => $skips, '%file' => $file->uri), WATCHDOG_WARNING);
}
return TRUE;
@@ -1121,6 +1126,7 @@ function _locale_import_one_string_db(&$report, $langcode, $context, $source, $t
// Text groups other than default still can contain HTML tags
// (i.e. translatable blocks).
if ($textgroup == "default" && !locale_string_is_safe($translation)) {
+ watchdog('locale', 'Import of string "%string" was skipped because of disallowed or malformed HTML.', array('%string' => $translation), WATCHDOG_ERROR);
$report['skips']++;
$lid = 0;
}
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 6fcf06f..dad77bb 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -927,7 +927,7 @@ class LocaleImportFunctionalTest extends DrupalWebTestCase {
// The import should have created 1 string and rejected 2.
$this->assertRaw(t('The translation was successfully imported. There are %number newly created translated strings, %update strings were updated and %delete strings were removed.', array('%number' => 1, '%update' => 0, '%delete' => 0)), 'The translation file was successfully imported.');
- $skip_message = format_plural(2, 'One translation string was skipped because it contains disallowed HTML.', '@count translation strings were skipped because they contain disallowed HTML.');
+ $skip_message = format_plural(2, 'A 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.', array('@url' => url('admin/reports/dblog')));
$this->assertRaw($skip_message, 'Unsafe strings were skipped.');