if (LOCALE != 'en_US') { if (is_dir(DIR_BASE . '/languages/' . LOCALE)) { $translate = new Zend_Translate('gettext', DIR_BASE . '/languages/' . LOCALE, LOCALE); } } if (!isset($translate)) { $translate = false; } } return $translate; } } } Localization::init(); function t($text) { $zt = Localization::getTranslate(); if (func_num_args() == 1) { if (is_object($zt)) { return $zt->_($text); } else { return $text; } } $arg = array(); for($i = 1 ; $i < func_num_args(); $i++) { $arg[] = func_get_arg($i); }
<?php /* * Define APPLICATION_ROOT constant here. * * The constant is used in include's and require's * across the code of the library. * */ define('APPLICATION_ROOT', $_SERVER['DOCUMENT_ROOT']); /* * Make $supported_locales available. * * Edit this array to add/remove locales. * */ require_once APPLICATION_ROOT . "/config/supported_locales.config.php"; require_once APPLICATION_ROOT . "/lib/Localization.class.php"; $localization = new Localization($supported_locales); $locale = $localization->init();