Skip to content

Commit 9bd95fc

Browse files
Merge branch '5.2' into 5.3
* 5.2: Use PHP_OS_FAMILY if possible Fix tests Fix minor typos [WebProfilerBundle] Fix the values of some CSS properties [Yaml] Fixed an exception message Fix ctype_digit deprecation Add a Special Case for Translating Choices in en_US_POSIX
2 parents 04ead89 + 5363c8f commit 9bd95fc

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

Tests/Service/ServiceSubscriberTraitTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ public function aParentService(): Service1
4242
{
4343
}
4444

45-
public function setContainer(ContainerInterface $container): ContainerInterface
45+
/**
46+
* @return ContainerInterface
47+
*/
48+
public function setContainer(ContainerInterface $container)
4649
{
4750
return $container;
4851
}

Translation/Test/TranslatorTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,17 @@ public function testTransChoiceWithDefaultLocale($expected, $id, $number)
8585
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
8686
}
8787

88+
/**
89+
* @dataProvider getTransChoiceTests
90+
*/
91+
public function testTransChoiceWithEnUsPosix($expected, $id, $number)
92+
{
93+
$translator = $this->getTranslator();
94+
$translator->setLocale('en_US_POSIX');
95+
96+
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
97+
}
98+
8899
public function testGetSetLocale()
89100
{
90101
$translator = $this->getTranslator();
@@ -313,7 +324,7 @@ public function successLangcodes()
313324
{
314325
return [
315326
['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']],
316-
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM']],
327+
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM', 'en_US_POSIX']],
317328
['3', ['be', 'bs', 'cs', 'hr']],
318329
['4', ['cy', 'mt', 'sl']],
319330
['6', ['ar']],

Translation/TranslatorTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private function getPluralizationRule(float $number, string $locale): int
142142
{
143143
$number = abs($number);
144144

145-
switch ('pt_BR' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
145+
switch ('pt_BR' !== $locale && 'en_US_POSIX' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
146146
case 'af':
147147
case 'bn':
148148
case 'bg':
@@ -151,6 +151,7 @@ private function getPluralizationRule(float $number, string $locale): int
151151
case 'de':
152152
case 'el':
153153
case 'en':
154+
case 'en_US_POSIX':
154155
case 'eo':
155156
case 'es':
156157
case 'et':

0 commit comments

Comments
 (0)