Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function load($resource, $locale, $domain = 'messages')
 {
     $rb = new \ResourceBundle($locale, $resource);
     if (!$rb) {
         throw new \RuntimeException("cannot load this resource : {$resource}");
     } elseif (intl_is_failure($rb->getErrorCode())) {
         throw new \RuntimeException($rb->getErrorMessage(), $rb->getErrorCode());
     }
     $messages = $this->flatten($rb);
     $catalogue = new MessageCatalogue($locale);
     $catalogue->add($messages, $domain);
     $catalogue->addResource(new FileResource($resource . '.dat'));
     return $catalogue;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function load($resource, $locale, $domain = 'messages')
 {
     if (!stream_is_local($resource . '.dat')) {
         throw new InvalidResourceException(sprintf('This is not a local file "%s".', $resource));
     }
     if (!file_exists($resource . '.dat')) {
         throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource));
     }
     $rb = new \ResourceBundle($locale, $resource);
     if (!$rb) {
         throw new InvalidResourceException(sprintf('Cannot load resource "%s"', $resource));
     } elseif (intl_is_failure($rb->getErrorCode())) {
         throw new InvalidResourceException($rb->getErrorMessage(), $rb->getErrorCode());
     }
     $messages = $this->flatten($rb);
     $catalogue = new MessageCatalogue($locale);
     $catalogue->add($messages, $domain);
     $catalogue->addResource(new FileResource($resource . '.dat'));
     return $catalogue;
 }
Exemplo n.º 3
0
<?php

$r = new ResourceBundle('en', 'ICUDATA');
$r->count();
$r->getErrorCode();
$r->getErrorMessage();
$r->get(0);
ResourceBundle::getLocales('');
resourcebundle_get($r, 0);
resourcebundle_locales('');