Skip to content

Commit f47e60a

Browse files
committed
[Intl] Fixed small bugs in the resource bundle transformation
1 parent 467cc93 commit f47e60a

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/Symfony/Component/Intl/ResourceBundle/LanguageBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function getLanguageName($lang, $region = null, $locale = null)
2828
}
2929

3030
if (null === ($languages = $this->readEntry($locale, array('Languages')))) {
31-
return array();
31+
return null;
3232
}
3333

3434
// Some languages are translated together with their region,

src/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/CurrencyBundleTransformationRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function beforeCreateStub(StubbingContextInterface $context)
7373
foreach ($currencyBundle->getCurrencyNames('en') as $code => $name) {
7474
$currencies[$code] = array(
7575
CurrencyBundle::INDEX_NAME => $name,
76-
CurrencyBundle::INDEX_SYMBOL => $currencyBundle->getCurrencySymbol('en', $code),
76+
CurrencyBundle::INDEX_SYMBOL => $currencyBundle->getCurrencySymbol($code, 'en'),
7777
CurrencyBundle::INDEX_FRACTION_DIGITS => $currencyBundle->getFractionDigits($code),
7878
CurrencyBundle::INDEX_ROUNDING_INCREMENT => $currencyBundle->getRoundingIncrement($code),
7979
);

src/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LocaleBundleTransformationRule.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ private function generateLocaleName($locale, $displayLocale)
201201

202202
// Some languages are simply not translated
203203
// Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans)
204-
if (null === ($name = $this->languageBundle->getLanguageName($displayLocale, $lang))) {
204+
if (null === ($name = $this->languageBundle->getLanguageName($lang, null, $displayLocale))) {
205205
return null;
206206
}
207207

@@ -216,7 +216,7 @@ private function generateLocaleName($locale, $displayLocale)
216216
// i.e. in zh_Hans_MO, "Hans" is the script
217217
if ($script) {
218218
// Some scripts are not translated into every language
219-
if (null === ($scriptName = $this->languageBundle->getScriptName($displayLocale, $script, $lang))) {
219+
if (null === ($scriptName = $this->languageBundle->getScriptName($script, $lang, $displayLocale))) {
220220
return null;
221221
}
222222

@@ -227,7 +227,7 @@ private function generateLocaleName($locale, $displayLocale)
227227
// i.e. in de_AT, "AT" is the region
228228
if ($region) {
229229
// Some regions are not translated into every language
230-
if (null === ($regionName = $this->regionBundle->getCountryName($displayLocale, $region))) {
230+
if (null === ($regionName = $this->regionBundle->getCountryName($region, $displayLocale))) {
231231
return null;
232232
}
233233

src/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testGetLanguageName()
4848
->with(self::RES_DIR, 'en', array('Languages'))
4949
->will($this->returnValue($languages));
5050

51-
$this->assertSame('German', $this->bundle->getLanguageName('de', 'en'));
51+
$this->assertSame('German', $this->bundle->getLanguageName('de', null, 'en'));
5252
}
5353

5454
public function testGetLanguageNameWithRegion()
@@ -115,7 +115,7 @@ public function testGetScriptName()
115115
->with(self::RES_DIR, 'en')
116116
->will($this->returnValue($data));
117117

118-
$this->assertSame('latin', $this->bundle->getScriptName('Latn', 'en'));
118+
$this->assertSame('latin', $this->bundle->getScriptName('Latn', null, 'en'));
119119
}
120120

121121
public function testGetScriptNameIncludedInLanguage()
@@ -177,7 +177,7 @@ public function testGetScriptNameNoScriptsBlock()
177177
->with(self::RES_DIR, 'en')
178178
->will($this->returnValue($data));
179179

180-
$this->assertNull($this->bundle->getScriptName('Latn', 'en'));
180+
$this->assertNull($this->bundle->getScriptName('Latn', null, 'en'));
181181
}
182182

183183
public function testGetScriptNames()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy