Source of file LanguageBundleTransformationRule.php
Size: 1,792 Bytes - Last Modified: 2013-07-17T08:22:21+02:00
/home/theseer/Downloads/Symfony/vendor/symfony/symfony/src/Symfony/Component/Intl/ResourceBundle/Transformer/Rule/LanguageBundleTransformationRule.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | <?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Intl\ResourceBundle\Transformer\Rule; use Symfony\Component\Intl\Intl; use Symfony\Component\Intl\ResourceBundle\Transformer\CompilationContextInterface; use Symfony\Component\Intl\ResourceBundle\Transformer\StubbingContextInterface; use Symfony\Component\Intl\Util\IcuVersion; /** * The rule for compiling the language bundle. * * @author Bernhard Schussek <bschussek@gmail.com> */ class LanguageBundleTransformationRule implements TransformationRuleInterface { /** * {@inheritdoc} */ public function getBundleName() { return 'lang'; } /** * {@inheritdoc} */ public function beforeCompile(CompilationContextInterface $context) { // The language data is contained in the locales bundle in ICU <= 4.2 if (IcuVersion::compare($context->getIcuVersion(), '4.2', '<=', 1)) { return $context->getSourceDir() . '/locales'; } return $context->getSourceDir() . '/lang'; } /** * {@inheritdoc} */ public function afterCompile(CompilationContextInterface $context) { } /** * {@inheritdoc} */ public function beforeCreateStub(StubbingContextInterface $context) { return array( 'Languages' => Intl::getLanguageBundle()->getLanguageNames('en'), 'Scripts' => Intl::getLanguageBundle()->getScriptNames('en'), ); } /** * {@inheritdoc} */ public function afterCreateStub(StubbingContextInterface $context) { } } |