4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule
;
14 use Symfony\Component\Intl\Intl
;
15 use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface
;
16 use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface
;
17 use Symfony\Component\Intl\Util\IcuVersion
;
20 * The rule for compiling the region bundle.
22 * @author Bernhard Schussek <bschussek@gmail.com>
24 class RegionBundleTransformationRule
implements TransformationRuleInterface
29 public function getBundleName()
37 public function beforeCompile(CompilationContextInterface
$context)
39 // The region data is contained in the locales bundle in ICU <= 4.2
40 if (IcuVersion
::compare($context->getIcuVersion(), '4.2', '<=', 1)) {
41 return $context->getSourceDir() . '/locales';
44 return $context->getSourceDir() . '/region';
50 public function afterCompile(CompilationContextInterface
$context)
57 public function beforeCreateStub(StubbingContextInterface
$context)
60 'Countries' => Intl
::getRegionBundle()->getCountryNames('en'),
67 public function afterCreateStub(StubbingContextInterface
$context)