[Intl] Fixed version comparisons in the transformation rules
This commit is contained in:
parent
470927d99e
commit
5d17de545b
|
@ -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'
|
||||||
|
|
|
@ -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';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue