public function __construct() { $args = func_get_args(); $options = array('delimiter' => ",", 'length' => 0, 'enclosure' => '"', 'scan' => 'directory', 'ignore' => 'email'); $data = !empty($args[0][0]) ? $args[0][0] : App_Main::getBaseDir('locale'); $locale = !empty($args[0][1]) ? $args[0][1] : App_Main::getWebsite()->getLocale(); App_Main::setErrorHandler(); try { parent::__construct($data, $locale, $options); } catch (Exception $e) { } }
public function testSpecialChars() { $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_specialchars.csv', 'en'); $this->assertEquals('Message 1 (en)', $adapter->translate('Message 1')); $this->assertEquals('Message 1 (en)', $adapter->_('Message 1')); $this->assertEquals('Message 6;" (en)', $adapter->translate('Message 6')); $this->assertEquals('Message 7 (en)', $adapter->translate('Message ;" 7')); }
protected function translateForm($id, $locale) { /* @var $form Zend_Form */ $trans = new Zend_Translate_Adapter_Csv(array("delimiter" => ",", "disableNotices" => true)); $file = PIMCORE_PLUGINS_PATH . "/Zendformbuilder/data/lang/form_" . $id . "_" . $locale . ".csv"; if (file_exists($file)) { $trans->addTranslation(array('content' => $file, 'locale' => $locale)); } $file = PIMCORE_PLUGINS_PATH . "/Zendformbuilder/data/lang/errors/" . $locale . "/Zend_Validate.php"; if (file_exists($file)) { $arrTrans = new Zend_Translate_Adapter_Array(array("disableNotices" => true)); $arrTrans->addTranslation(array("content" => $file, "locale" => $locale)); $trans->addTranslation($arrTrans); } return $trans; }
public function testList() { $adapter = new Zend_Translate_Adapter_Csv(dirname(__FILE__) . '/_files/translation_en.csv', 'en'); $this->assertEquals(array('en' => 'en'), $adapter->getList()); $adapter->addTranslation(dirname(__FILE__) . '/_files/translation_en.csv', 'de'); $this->assertEquals(array('en' => 'en', 'de' => 'de'), $adapter->getList()); $this->assertTrue($adapter->isAvailable('de')); $locale = new Zend_Locale('en'); $this->assertTrue($adapter->isAvailable($locale)); $this->assertFalse($adapter->isAvailable('sr')); }