public function testWriteResourceBundle()
 {
     IntlTestHelper::requireFullIntl($this);
     $bundle = new \ResourceBundle('rb', __DIR__ . '/Fixtures', false);
     $this->writer->write($this->directory, 'en', $bundle);
     $this->assertFileEquals(__DIR__ . '/Fixtures/rb.php', $this->directory . '/en.php');
 }
 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>');
 }
 /**
  * @requires extension intl
  */
 public function testWriteResourceBundle()
 {
     if (PHP_VERSION_ID < 50315 || PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404) {
         $this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
     }
     $bundle = new \ResourceBundle('rb', __DIR__ . '/Fixtures', false);
     $this->writer->write($this->directory, 'en', $bundle);
     $this->assertFileEquals(__DIR__ . '/Fixtures/rb.php', $this->directory . '/en.php');
 }
 public function testWriteResourceBundle()
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $this->markTestSkipped('The intl extension is not available.');
     }
     if (PHP_VERSION_ID < 50315 || PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404) {
         $this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
     }
     $bundle = new \ResourceBundle('rb', __DIR__ . '/Fixtures', false);
     $this->writer->write($this->directory, 'en', $bundle);
     $this->assertFileEquals(__DIR__ . '/Fixtures/rb.php', $this->directory . '/en.php');
 }
Example #5
0
    public function testWriteResourceBundle()
    {
        // We only run tests if the intl extension is loaded...
        if (!Intl::isExtensionLoaded()) {
            $this->markTestSkipped('The intl extension is not available.');
        }

        $bundle = new \ResourceBundle('rb', __DIR__.'/Fixtures', false);

        $this->writer->write($this->directory, 'en', $bundle);

        $this->assertFileEquals(__DIR__.'/Fixtures/rb.php', $this->directory.'/en.php');
    }