public function addTextDomain($domain, $path) { // check path if (!is_dir($path)) { throw new ConfigurationException("Translator configuration path `{$path}` not found"); } bindtextdomain($domain, $path); // @todo: hardcoded codeset bind_textdomain_codeset($domain, 'UTF-8'); return $this; }
/** * Test Translator initialization * * @expectedException \Bluz\Common\Exception\ConfigurationException */ public function testInvalidConfigurationThrowException() { $translator = new Translator(); $translator->addTextDomain('any', '/this/directory/is/not/exists'); }