From 62f3724acbdf60b7a17c452e74f099b5236d41cb Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 10 Feb 2009 05:37:42 +0000 Subject: Adding UI for site language selection and user language preference. --- core/libraries/I18n.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'core/libraries') diff --git a/core/libraries/I18n.php b/core/libraries/I18n.php index f69aa66f..475b14b6 100644 --- a/core/libraries/I18n.php +++ b/core/libraries/I18n.php @@ -55,6 +55,7 @@ class I18n_Core { private function __construct($config) { $this->_config = $config; + $this->setLocale($config['default_locale']); } public static function instance($config=null) { @@ -71,6 +72,11 @@ class I18n_Core { public function setLocale($locale) { $this->_config['default_locale'] = $locale; + // Attempt to set PHP's locale as well (for number formatting, collation, etc.) + // TODO: See G2 for better fallack code. + $locale_prefs = array($locale); + $locale_prefs[] = 'en_US'; + setlocale(LC_ALL, $locale_prefs); } /** -- cgit v1.2.3