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 language bundle.
22 * @author Bernhard Schussek <bschussek@gmail.com>
24 class LanguageBundleTransformationRule
implements TransformationRuleInterface
29 public function getBundleName()
37 public function beforeCompile(CompilationContextInterface
$context)
39 // The language 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() . '/lang';
50 public function afterCompile(CompilationContextInterface
$context)
57 public function beforeCreateStub(StubbingContextInterface
$context)
60 'Languages' => Intl
::getLanguageBundle()->getLanguageNames('en'),
61 'Scripts' => Intl
::getLanguageBundle()->getScriptNames('en'),
68 public function afterCreateStub(StubbingContextInterface
$context)