array('en' => 'en')); protected $countrylong = array('GB' => 'Britain (UK).'); protected $languagelong = array('en' => 'English.'); protected function __construct() { if (Gettext::SUPPORTED == false) { return; } // singlton } static public function get_instance() { if (self::$instance == null) { self::$instance = new self; } return self::$instance; } public function get_countries() { // get countries $countries = array(); foreach ($this->languages as $country => $languages) { $countries[] = $country; } return $countries; } public function get_languages($country) { // get languages return $this->languages[$country]; } public function set_language($country, $language) { // set language if (array_search($language,$this->languages[$country])) { $this->country = $country; $this->language = $language; $code = $language.'_'.$country; $domain = 'cycle'; bindtextdomain($domain, Ide::LOCALE_DIR); textdomain($domain); putenv("LANG=$code"); setlocale(LC_ALL, $code); } } public function get_language() { return $this->language; } public function get_language_long($language){ return $this->languagelong[$language]; } public function get_country_long($country){ return $this->countrylong[$country]; } public function get_country() { return $this->country; } } $settings = Ini::get_instance(); $gettext = Gettext::get_instance(); $country = $settings->get_value('gettext', 'country'); $language = $settings->get_value('gettext', 'language'); echo $gettext->get_language_long($language).' '.$gettext->get_country_long($country)."\n"; $gettext->set_language($country, $language); ?>