diff core/modules/locale/src/LocaleLookup.php @ 12:7a779792577d

Update Drupal core to v8.4.5 (via Composer)
author Chris Cannam
date Fri, 23 Feb 2018 15:52:07 +0000
parents 4c8ae668cc8c
children af1871eacc83
line wrap: on
line diff
--- a/core/modules/locale/src/LocaleLookup.php	Fri Feb 23 15:51:18 2018 +0000
+++ b/core/modules/locale/src/LocaleLookup.php	Fri Feb 23 15:52:07 2018 +0000
@@ -7,6 +7,7 @@
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Language\LanguageManagerInterface;
 use Drupal\Core\Lock\LockBackendInterface;
+use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
 use Symfony\Component\HttpFoundation\RequestStack;
 
 /**
@@ -172,6 +173,12 @@
       }
     }
 
+    if (is_string($value) && strpos($value, PluralTranslatableMarkup::DELIMITER) !== FALSE) {
+      // Community translations imported from localize.drupal.org as well as
+      // migrated translations may contain @count[number].
+      $value = preg_replace('!@count\[\d+\]!', '@count', $value);
+    }
+
     $this->storage[$offset] = $value;
     // Disabling the usage of string caching allows a module to watch for
     // the exact list of strings used on a page. From a performance