/** * Test that parent bundles are loaded. */ public function testGetParentLocale() { $this->assertEquals(null, $this->parent->getParentLocale()); $this->assertInstanceOf('Titon\\G11n\\Locale', $this->formats->getParentLocale()); $this->assertInstanceOf('Titon\\G11n\\Locale', $this->inflections->getParentLocale()); $this->assertInstanceOf('Titon\\G11n\\Locale', $this->validations->getParentLocale()); }
/** * Sets up the application with the defined locale key; the key will be formatted to a lowercase dashed URL friendly format. * The system will then attempt to load the locale resource bundle and finalize configuration settings. * * @param \Titon\G11n\Locale $locale * @return \Titon\G11n\Locale */ public function addLocale(Locale $locale) { $key = self::canonicalize($locale->getCode()); if (isset($this->_locales[$key])) { return $this->_locales[$key]; } // Configure and initialize foreach ($this->getResourcePaths() as $domain => $paths) { $locale->addResourcePaths($domain, $paths); } $locale->initialize(); // Set the locale $this->_locales[$key] = $locale; // Set the parent as well if ($parent = $locale->getParentLocale()) { $this->addLocale($parent); } // Set fallback if none defined if (!$this->_fallback) { $this->setFallback($key); } return $locale; }