[Intl] Fixed small bugs in the resource bundle transformation

This commit is contained in:
Bernhard Schussek 2013-03-15 22:36:48 +01:00
parent 467cc93447
commit f47e60a6c6
4 changed files with 8 additions and 8 deletions

View File

@ -28,7 +28,7 @@ class LanguageBundle extends AbstractBundle implements LanguageBundleInterface
}
if (null === ($languages = $this->readEntry($locale, array('Languages')))) {
return array();
return null;
}
// Some languages are translated together with their region,

View File

@ -73,7 +73,7 @@ class CurrencyBundleTransformationRule implements TransformationRuleInterface
foreach ($currencyBundle->getCurrencyNames('en') as $code => $name) {
$currencies[$code] = array(
CurrencyBundle::INDEX_NAME => $name,
CurrencyBundle::INDEX_SYMBOL => $currencyBundle->getCurrencySymbol('en', $code),
CurrencyBundle::INDEX_SYMBOL => $currencyBundle->getCurrencySymbol($code, 'en'),
CurrencyBundle::INDEX_FRACTION_DIGITS => $currencyBundle->getFractionDigits($code),
CurrencyBundle::INDEX_ROUNDING_INCREMENT => $currencyBundle->getRoundingIncrement($code),
);

View File

@ -201,7 +201,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
// Some languages are simply not translated
// Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans)
if (null === ($name = $this->languageBundle->getLanguageName($displayLocale, $lang))) {
if (null === ($name = $this->languageBundle->getLanguageName($lang, null, $displayLocale))) {
return null;
}
@ -216,7 +216,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
// i.e. in zh_Hans_MO, "Hans" is the script
if ($script) {
// Some scripts are not translated into every language
if (null === ($scriptName = $this->languageBundle->getScriptName($displayLocale, $script, $lang))) {
if (null === ($scriptName = $this->languageBundle->getScriptName($script, $lang, $displayLocale))) {
return null;
}
@ -227,7 +227,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
// i.e. in de_AT, "AT" is the region
if ($region) {
// Some regions are not translated into every language
if (null === ($regionName = $this->regionBundle->getCountryName($displayLocale, $region))) {
if (null === ($regionName = $this->regionBundle->getCountryName($region, $displayLocale))) {
return null;
}

View File

@ -48,7 +48,7 @@ class LanguageBundleTest extends \PHPUnit_Framework_TestCase
->with(self::RES_DIR, 'en', array('Languages'))
->will($this->returnValue($languages));
$this->assertSame('German', $this->bundle->getLanguageName('de', 'en'));
$this->assertSame('German', $this->bundle->getLanguageName('de', null, 'en'));
}
public function testGetLanguageNameWithRegion()
@ -115,7 +115,7 @@ class LanguageBundleTest extends \PHPUnit_Framework_TestCase
->with(self::RES_DIR, 'en')
->will($this->returnValue($data));
$this->assertSame('latin', $this->bundle->getScriptName('Latn', 'en'));
$this->assertSame('latin', $this->bundle->getScriptName('Latn', null, 'en'));
}
public function testGetScriptNameIncludedInLanguage()
@ -177,7 +177,7 @@ class LanguageBundleTest extends \PHPUnit_Framework_TestCase
->with(self::RES_DIR, 'en')
->will($this->returnValue($data));
$this->assertNull($this->bundle->getScriptName('Latn', 'en'));
$this->assertNull($this->bundle->getScriptName('Latn', null, 'en'));
}
public function testGetScriptNames()