protected function execute(InputInterface $input, OutputInterface $output)
 {
     $textWriter = new TextBundleWriter();
     $textWriter->write(CACHE_PATH . 'intl/text_bundle', 'en', ['data' => ['Ok']]);
     $textWriter->write(CACHE_PATH . 'intl/text_bundle', 'ru', ['data' => ['Хорошо']]);
     $phpWriter = new PhpBundleWriter();
     $phpWriter->write(CACHE_PATH . 'intl/php_bundle', 'en', ['data' => 'php bundle: Ok', 'nested' => ['message' => 'Hi!']]);
     $phpWriter = new PhpBundleWriter();
     $phpWriter->write(CACHE_PATH . 'intl/php_bundle', 'ru', ['data' => 'php bundle: Хорошо', 'nested' => ['message' => 'Привет!']]);
     $compiler = new GenrbCompiler();
     $compiler->compile(CACHE_PATH . 'intl/text_bundle', CACHE_PATH . 'intl/compiled');
     $phpReader = new PhpBundleReader();
     $data = $phpReader->read(CACHE_PATH . 'intl/php_bundle', 'en');
     $output->writeln($data['data']);
     $data = $phpReader->read(CACHE_PATH . 'intl/php_bundle', 'ru');
     $output->writeln($data['data']);
     $reader = new BundleEntryReader($phpReader);
     $data = $reader->readEntry(CACHE_PATH . 'intl/php_bundle', 'ru', ['nested', 'message']);
     $output->writeln($data);
     $language = Intl::getLanguageBundle()->getLanguageName('ru', 'RU', 'en');
     $output->writeln($language);
     $language = Intl::getLanguageBundle()->getLanguageName('ru', 'RU', 'de');
     $output->writeln($language);
     $language = Intl::getLanguageBundle()->getLanguageName('ru', 'RU', 'ru');
     $output->writeln($language);
     $currencyName = Intl::getCurrencyBundle()->getCurrencyName('RUB', 'en');
     $output->writeln($currencyName);
     $currencyName = Intl::getCurrencyBundle()->getCurrencySymbol('USD', 'en');
     $output->writeln($currencyName);
     $output->writeln('<comment>Ok</comment>');
 }
 /**
  * @dataProvider provideMergeableValues
  */
 public function testFollowLocaleAliases($childData, $parentData, $result)
 {
     $this->reader->setLocaleAliases(array('mo' => 'ro_MD'));
     if (null === $childData || is_array($childData)) {
         $this->readerImpl->expects($this->at(0))->method('read')->with(self::RES_DIR, 'ro_MD')->will($this->returnValue(array('Foo' => array('Bar' => $childData))));
         // Read fallback locale of aliased locale ("ro_MD" -> "ro")
         $this->readerImpl->expects($this->at(1))->method('read')->with(self::RES_DIR, 'ro')->will($this->returnValue(array('Foo' => array('Bar' => $parentData))));
     } else {
         $this->readerImpl->expects($this->once())->method('read')->with(self::RES_DIR, 'ro_MD')->will($this->returnValue(array('Foo' => array('Bar' => $childData))));
     }
     $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'mo', array('Foo', 'Bar'), true));
 }
 /**
  * @return BundleEntryReader
  */
 protected function createEntryReader()
 {
     $entryReader = new BundleEntryReader($this->createBundleReader());
     $entryReader->setLocaleAliases($this->getLocaleAliases());
     return $entryReader;
 }