public function __construct() { parent::__construct(); $this->locale = $_SESSION['set_lang']; $this->host = $GLOBALS['cgp_host']; $this->userId = $GLOBALS['obm']['uid']; // to move somewhere else... mb_internal_encoding("UTF-8"); SI18n::set_locale($this->locale); self::set_template_root(dirname(__FILE__).'/../../views/mail'); $this->userInfo = get_user_info(); }
public function test_translate_and_pluralize() { $this->assertEquals('2 messages', SI18n::translate_and_pluralize('inbox', 2)); $this->assertEquals('2 messages', _p('inbox', 2)); }
<?php require_once(dirname(__FILE__).'/../lib/Stato/i18n/i18n.php'); if($GLOBALS['module']) { SI18n::add_data_path(dirname(__FILE__).'/../../conf/locale/'.$GLOBALS['module']); SI18n::add_data_path(dirname(__FILE__).'/../../locale/'.$GLOBALS['module']); } SI18n::add_data_path(dirname(__FILE__).'/../../locale'); SI18n::add_data_path(dirname(__FILE__).'/../../conf/locale');
function get_localized_country($code) { $countries = include(dirname(__FILE__)."/../lib/Stato/i18n/data/countries/".SI18n::get_locale().".php"); return $countries[$code]; }
public static function set_locale($locale) { self::$locale = $locale; }
public function test_set_locale_from_http_accept() { $http_accept = 'fr-fr,fr;q=0.8,en-us;q=0.6,en;q=0.4,de;q=0.2'; SI18n::set_locale(Locale::acceptFromHttp($http_accept)); $this->assertEquals('fr_FR', SI18n::get_locale()); }