[Intl] Fixed small bugs in the resource bundle transformation
This commit is contained in:
parent
467cc93447
commit
f47e60a6c6
@ -28,7 +28,7 @@ class LanguageBundle extends AbstractBundle implements LanguageBundleInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === ($languages = $this->readEntry($locale, array('Languages')))) {
|
if (null === ($languages = $this->readEntry($locale, array('Languages')))) {
|
||||||
return array();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some languages are translated together with their region,
|
// Some languages are translated together with their region,
|
||||||
|
@ -73,7 +73,7 @@ class CurrencyBundleTransformationRule implements TransformationRuleInterface
|
|||||||
foreach ($currencyBundle->getCurrencyNames('en') as $code => $name) {
|
foreach ($currencyBundle->getCurrencyNames('en') as $code => $name) {
|
||||||
$currencies[$code] = array(
|
$currencies[$code] = array(
|
||||||
CurrencyBundle::INDEX_NAME => $name,
|
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_FRACTION_DIGITS => $currencyBundle->getFractionDigits($code),
|
||||||
CurrencyBundle::INDEX_ROUNDING_INCREMENT => $currencyBundle->getRoundingIncrement($code),
|
CurrencyBundle::INDEX_ROUNDING_INCREMENT => $currencyBundle->getRoundingIncrement($code),
|
||||||
);
|
);
|
||||||
|
@ -201,7 +201,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
|
|||||||
|
|
||||||
// Some languages are simply not translated
|
// Some languages are simply not translated
|
||||||
// Example: "az" (Azerbaijani) has no translation in "af" (Afrikaans)
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
|
|||||||
// i.e. in zh_Hans_MO, "Hans" is the script
|
// i.e. in zh_Hans_MO, "Hans" is the script
|
||||||
if ($script) {
|
if ($script) {
|
||||||
// Some scripts are not translated into every language
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ class LocaleBundleTransformationRule implements TransformationRuleInterface
|
|||||||
// i.e. in de_AT, "AT" is the region
|
// i.e. in de_AT, "AT" is the region
|
||||||
if ($region) {
|
if ($region) {
|
||||||
// Some regions are not translated into every language
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ class LanguageBundleTest extends \PHPUnit_Framework_TestCase
|
|||||||
->with(self::RES_DIR, 'en', array('Languages'))
|
->with(self::RES_DIR, 'en', array('Languages'))
|
||||||
->will($this->returnValue($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()
|
public function testGetLanguageNameWithRegion()
|
||||||
@ -115,7 +115,7 @@ class LanguageBundleTest extends \PHPUnit_Framework_TestCase
|
|||||||
->with(self::RES_DIR, 'en')
|
->with(self::RES_DIR, 'en')
|
||||||
->will($this->returnValue($data));
|
->will($this->returnValue($data));
|
||||||
|
|
||||||
$this->assertSame('latin', $this->bundle->getScriptName('Latn', 'en'));
|
$this->assertSame('latin', $this->bundle->getScriptName('Latn', null, 'en'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetScriptNameIncludedInLanguage()
|
public function testGetScriptNameIncludedInLanguage()
|
||||||
@ -177,7 +177,7 @@ class LanguageBundleTest extends \PHPUnit_Framework_TestCase
|
|||||||
->with(self::RES_DIR, 'en')
|
->with(self::RES_DIR, 'en')
|
||||||
->will($this->returnValue($data));
|
->will($this->returnValue($data));
|
||||||
|
|
||||||
$this->assertNull($this->bundle->getScriptName('Latn', 'en'));
|
$this->assertNull($this->bundle->getScriptName('Latn', null, 'en'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetScriptNames()
|
public function testGetScriptNames()
|
||||||
|
Reference in New Issue
Block a user