/** * Return a message string if it exists. * * @param string $key * @param array $vars * * @return string */ public function message($key, array $vars = array()) { try { $translated = parent::message($key, $vars); } catch (OutOfRangeException $e) { if ($this->defaultLocale === null) { throw $e; } // fallback default locale $locale = $this->getConfig('locale'); $this->setLocale($this->defaultLocale); $translated = parent::message($key, $vars); $this->setLocale($locale); } return $translated; }
/** * @expectedException \Decoda\Exception\MissingLocaleException */ public function testCustomConfigPath() { $decoda = new Decoda('', array('configPath' => '/some/fake/path')); $this->assertEquals('Spoiler', $decoda->message('spoiler')); }