From 1dc01d0b41edf380870df0dcb43a4f59e57faca9 Mon Sep 17 00:00:00 2001 From: azine Date: Thu, 4 Jun 2015 23:35:17 +0200 Subject: [PATCH] Allow new lines in Messages translated with transchoice() Hi, I found that the MessageSelector does not handle new lines in messages very well. I suggest adding the "s" modifier to the regexp used to identify the parts and ranges. What do you think? --- src/Symfony/Component/Translation/MessageSelector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Translation/MessageSelector.php b/src/Symfony/Component/Translation/MessageSelector.php index 9f5430cfe29ae..f7fde31ad9090 100644 --- a/src/Symfony/Component/Translation/MessageSelector.php +++ b/src/Symfony/Component/Translation/MessageSelector.php @@ -57,7 +57,7 @@ public function choose($message, $number, $locale) foreach ($parts as $part) { $part = trim($part); - if (preg_match('/^(?P'.Interval::getIntervalRegexp().')\s*(?P.*?)$/x', $part, $matches)) { + if (preg_match('/^(?P'.Interval::getIntervalRegexp().')\s*(?P.*?)$/xs', $part, $matches)) { $explicitRules[$matches['interval']] = $matches['message']; } elseif (preg_match('/^\w+\:\s*(.*?)$/', $part, $matches)) { $standardRules[] = $matches[1];