Skip to content

Commit 5363c8f

Browse files
Merge branch '4.4' into 5.2
* 4.4: 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 9dd2949 + 0d62799 commit 5363c8f

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
@@ -83,6 +83,17 @@ public function testTransChoiceWithDefaultLocale($expected, $id, $number)
8383
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
8484
}
8585

86+
/**
87+
* @dataProvider getTransChoiceTests
88+
*/
89+
public function testTransChoiceWithEnUsPosix($expected, $id, $number)
90+
{
91+
$translator = $this->getTranslator();
92+
$translator->setLocale('en_US_POSIX');
93+
94+
$this->assertEquals($expected, $translator->trans($id, ['%count%' => $number]));
95+
}
96+
8697
public function testGetSetLocale()
8798
{
8899
$translator = $this->getTranslator();
@@ -311,7 +322,7 @@ public function successLangcodes()
311322
{
312323
return [
313324
['1', ['ay', 'bo', 'cgg', 'dz', 'id', 'ja', 'jbo', 'ka', 'kk', 'km', 'ko', 'ky']],
314-
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM']],
325+
['2', ['nl', 'fr', 'en', 'de', 'de_GE', 'hy', 'hy_AM', 'en_US_POSIX']],
315326
['3', ['be', 'bs', 'cs', 'hr']],
316327
['4', ['cy', 'mt', 'sl']],
317328
['6', ['ar']],

Translation/TranslatorTrait.php

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

143-
switch ('pt_BR' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
143+
switch ('pt_BR' !== $locale && 'en_US_POSIX' !== $locale && \strlen($locale) > 3 ? substr($locale, 0, strrpos($locale, '_')) : $locale) {
144144
case 'af':
145145
case 'bn':
146146
case 'bg':
@@ -149,6 +149,7 @@ private function getPluralizationRule(float $number, string $locale): int
149149
case 'de':
150150
case 'el':
151151
case 'en':
152+
case 'en_US_POSIX':
152153
case 'eo':
153154
case 'es':
154155
case 'et':

0 commit comments

Comments
 (0)