コード例 #1
0
 /**
  * Create the locale-service
  *
  * @param \Zend\ServiceManager\ServiceLocatorInterface $serviceLocator
  * @return \Zork\I18n\Locale\Locale
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     // Configure the locale
     $config = $serviceLocator->get('Configuration');
     $srvConfig = isset($config['locale']) ? $config['locale'] : array();
     return Locale::factory($srvConfig);
 }
コード例 #2
0
ファイル: LocaleTest.php プロジェクト: gridguyz/zork
 /**
  * Test accept from http
  */
 public function testAccesptFromHttp()
 {
     $locale = Locale::factory(array('default' => 'en', 'available' => array('en' => true, 'fr' => true, 'de' => true)));
     $this->assertEquals('en', $locale->acceptFromHttp(null));
     $this->assertEquals('fr', $locale->acceptFromHttp('fr'));
     $this->assertEquals('fr', $locale->acceptFromHttp('fr, *;q=0.1'));
     $this->assertEquals('fr', $locale->acceptFromHttp('fr, de;q=0.8, *;q=0.1'));
     $this->assertEquals('de', $locale->acceptFromHttp('fr;q=0.8, de, *;q=0.1'));
     $this->assertEquals('de', $locale->acceptFromHttp('hu-HU, de;q=0.8, *;q=0.1'));
     $this->assertEquals('de', $locale->acceptFromHttp('hu, de-DE;q=0.8, *;q=0.1'));
     $this->assertEquals('en', $locale->acceptFromHttp('hu, no;q=0.8, *;q=0.1'));
 }
コード例 #3
0
ファイル: LocaleTest.php プロジェクト: gridguyz/zork
 /**
  * This method is called before the first test of this test class is run.
  */
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     static::$helperCtorArgs = array(static::$locale = Locale::factory(array('default' => 'en', 'fallback' => 'en', 'available' => array('en' => true, 'en_US' => true))));
 }