From c2eee4746533af10779934f705138fe9bb567550 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Tue, 10 Feb 2009 02:37:16 +0000 Subject: Move site default_locale into DB (vars) and add a per user locale preference. There's no UI to select the locale yet. --- core/libraries/I18n.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'core/libraries') diff --git a/core/libraries/I18n.php b/core/libraries/I18n.php index 19215325..7323ea1d 100644 --- a/core/libraries/I18n.php +++ b/core/libraries/I18n.php @@ -56,7 +56,6 @@ class I18n_Core { private $_cache = array(); - private function __construct($config) { $this->_config = $config; } @@ -64,12 +63,19 @@ class I18n_Core { public static function instance($config=null) { if (self::$_instance == NULL || isset($config)) { $config = isset($config) ? $config : Kohana::config('locale'); + if (empty($config['default_locale'])) { + $config['default_locale'] = module::get_var('core', 'default_locale'); + } self::$_instance = new I18n_Core($config); } return self::$_instance; } + public function setLocale($locale) { + $this->_config['default_locale'] = $locale; + } + /** * Translates a localizable message. * @param $message String|array The message to be translated. E.g. "Hello world" -- cgit v1.2.3