[Intl] Fixed version comparisons in the transformation rules

This commit is contained in:
Bernhard Schussek 2013-03-16 11:43:45 +01:00
parent 470927d99e
commit 5d17de545b
3 changed files with 6 additions and 3 deletions

View File

@ -15,6 +15,7 @@ use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\ResourceBundle\CurrencyBundle; use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface; use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface; use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
use Symfony\Component\Intl\Util\IcuVersion;
/** /**
* The rule for compiling the currency bundle. * The rule for compiling the currency bundle.
@ -38,7 +39,7 @@ class CurrencyBundleTransformationRule implements TransformationRuleInterface
{ {
// The currency data is contained in the locales and misc bundles // The currency data is contained in the locales and misc bundles
// in ICU <= 4.2 // in ICU <= 4.2
if (version_compare($context->getIcuVersion(), '4.2', '<=')) { if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
return array( return array(
$context->getSourceDir() . '/misc/supplementalData.txt', $context->getSourceDir() . '/misc/supplementalData.txt',
$context->getSourceDir() . '/locales' $context->getSourceDir() . '/locales'

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule;
use Symfony\Component\Intl\Intl; use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface; use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface; use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
use Symfony\Component\Intl\Util\IcuVersion;
/** /**
* The rule for compiling the language bundle. * The rule for compiling the language bundle.
@ -36,7 +37,7 @@ class LanguageBundleTransformationRule implements TransformationRuleInterface
public function beforeCompile(CompilationContextInterface $context) public function beforeCompile(CompilationContextInterface $context)
{ {
// The language data is contained in the locales bundle in ICU <= 4.2 // The language data is contained in the locales bundle in ICU <= 4.2
if (version_compare($context->getIcuVersion(), '4.2', '<=')) { if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
return $context->getSourceDir() . '/locales'; return $context->getSourceDir() . '/locales';
} }

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule;
use Symfony\Component\Intl\Intl; use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface; use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface;
use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface; use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface;
use Symfony\Component\Intl\Util\IcuVersion;
/** /**
* The rule for compiling the region bundle. * The rule for compiling the region bundle.
@ -36,7 +37,7 @@ class RegionBundleTransformationRule implements TransformationRuleInterface
public function beforeCompile(CompilationContextInterface $context) public function beforeCompile(CompilationContextInterface $context)
{ {
// The region data is contained in the locales bundle in ICU <= 4.2 // The region data is contained in the locales bundle in ICU <= 4.2
if (version_compare($context->getIcuVersion(), '4.2', '<=')) { if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
return $context->getSourceDir() . '/locales'; return $context->getSourceDir() . '/locales';
} }