diff options
author | INOPIAE <inopiae@cacert.org> | 2015-08-09 19:12:51 +0200 |
---|---|---|
committer | Benny Baumann <BenBE@geshi.org> | 2015-08-09 22:23:21 +0200 |
commit | 4edd7b57c0057f9cfab0874a198256b87bd018b7 (patch) | |
tree | 2a623eade7fea29bda28e15692991821448c8fe1 /manager/library/i18n/I18n.php | |
parent | ce38587c8459587d7a03002ebcb4427ed95fb85c (diff) | |
download | cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.gz cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.tar.xz cacert-mgr-4edd7b57c0057f9cfab0874a198256b87bd018b7.zip |
bug 1396: Codestyle cleanup
Diffstat (limited to 'manager/library/i18n/I18n.php')
-rw-r--r-- | manager/library/i18n/I18n.php | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/manager/library/i18n/I18n.php b/manager/library/i18n/I18n.php index 961ae6c..64e8a93 100644 --- a/manager/library/i18n/I18n.php +++ b/manager/library/i18n/I18n.php @@ -8,88 +8,88 @@ require_once('l10n/L10n.php'); class I18n { - /** - * static pointer to instance - * @var array(I18n) - */ - private static $instance = null; + /** + * static pointer to instance + * @var array(I18n) + */ + private static $instance = null; - /** - * config object - * @var Zend_Translate - */ - private $translate = null; + /** + * config object + * @var Zend_Translate + */ + private $translate = null; - /** - * make new translate - */ - protected function __construct() { - $options = array( - 'log' => Log::Log(), - 'logUntranslated' => false - ); + /** + * make new translate + */ + protected function __construct() { + $options = array( + 'log' => Log::Log(), + 'logUntranslated' => false + ); - $locale = L10n::getInstance(); - $supported = $locale->getBrowser(); - arsort($supported, SORT_NUMERIC); + $locale = L10n::getInstance(); + $supported = $locale->getBrowser(); + arsort($supported, SORT_NUMERIC); - $file = ''; - foreach ($supported as $loc => $val) { - if (file_exists(LOCALE_PATH . '/' . $loc . '/locale.php')) { - $file = LOCALE_PATH . '/' . $loc . '/locale.php'; - $locale->setLocale($loc); - break; - } - } + $file = ''; + foreach ($supported as $loc => $val) { + if (file_exists(LOCALE_PATH . '/' . $loc . '/locale.php')) { + $file = LOCALE_PATH . '/' . $loc . '/locale.php'; + $locale->setLocale($loc); + break; + } + } - if ($file == '' && file_exists(LOCALE_PATH . '/en_US/locale.php')) { - $file = LOCALE_PATH . '/en_US/locale.php'; - $locale->setLocale('en_US'); - } + if ($file == '' && file_exists(LOCALE_PATH . '/en_US/locale.php')) { + $file = LOCALE_PATH . '/en_US/locale.php'; + $locale->setLocale('en_US'); + } - if ($file != '') { - $this->translate = new Zend_Translate(Zend_Translate::AN_ARRAY, $file, $locale->getLanguage(), $options); - #Log::Log()->debug('locale ' . $locale->getLanguage() . '_' .$locale->getRegion() . ' loaded'); - } - else - throw new Exception(__METHOD__ . ': no translation files available'); - } + if ($file != '') { + $this->translate = new Zend_Translate(Zend_Translate::AN_ARRAY, $file, $locale->getLanguage(), $options); + #Log::Log()->debug('locale ' . $locale->getLanguage() . '_' .$locale->getRegion() . ' loaded'); + } + else + throw new Exception(__METHOD__ . ': no translation files available'); + } - /** - * get already existing instance, make new instance or throw an exception - * @return I18n - */ - public static function getInstance() { - if (self::$instance === null) { - self::$instance = new I18n(); - } + /** + * get already existing instance, make new instance or throw an exception + * @return I18n + */ + public static function getInstance() { + if (self::$instance === null) { + self::$instance = new I18n(); + } - return self::$instance; - } + return self::$instance; + } - /** - * return the Zend_Translate object - * @return Zend_Translate - */ - public static function getTranslate() { - return self::getInstance()->translate; - } + /** + * return the Zend_Translate object + * @return Zend_Translate + */ + public static function getTranslate() { + return self::getInstance()->translate; + } - /** - * map _ to translate - * @param unknown_type $text - * @param unknown_type $locale - */ - public function _($text, $locale = null) { - return self::getInstance()->translate->_($text, $locale); - } + /** + * map _ to translate + * @param unknown_type $text + * @param unknown_type $locale + */ + public function _($text, $locale = null) { + return self::getInstance()->translate->_($text, $locale); + } - /** - * magic __call dispatches all unknown methods to Zend_Translate - * @param unknown_type $method - * @param unknown_type $arguments - */ - public function __call($method, $arguments) { - return call_user_func_array(array($this->translate, $method), $arguments); - } + /** + * magic __call dispatches all unknown methods to Zend_Translate + * @param unknown_type $method + * @param unknown_type $arguments + */ + public function __call($method, $arguments) { + return call_user_func_array(array($this->translate, $method), $arguments); + } } |