public function get($message) { if ($this->language === null) { return $message; } return $this->language->localize($message); }
public function load(Gpf_Lang_Language $language) { $file = new Gpf_Io_File($this->getFilename()); try { $file->open('r'); } catch (Exception $e) { try { $this->regenerateLanguageCacheFiles(); $file->open('r'); } catch (Exception $e2) { throw new Gpf_Exception($this->_('Could not open language file %s', $e2->getMessage())); } } $_name = ''; $_engName = ''; $_author = ''; $_version = ''; $_dict = ''; $_dateFormat = ''; $_timeFormat = ''; $_thousandsSeparator = ''; $_decimalSeparator = ''; if (@eval(str_replace(array('<?php', '?>'), '', $file->getContents())) === false) { throw new Gpf_Exception($this->_('Corrupted language file %s', $file->getFileName())); } @$language->setName($_name); @$language->setEnglishName($_engName); @$language->setAuthor($_author); @$language->setVersion($_version); @$language->setDictionary($_dict); @$language->setDateFormat($_dateFormat); @$language->setTimeFormat($_timeFormat); @$language->setThousandsSeparator($_thousandsSeparator); @$language->setDecimalSeparator($_decimalSeparator); }
/** * @return Gpf_Lang_Language */ private function loadLanguage($languageCode) { $language = new Gpf_Lang_Language($languageCode); $language->load(); return $language; }