summaryrefslogtreecommitdiff
path: root/core/libraries
diff options
context:
space:
mode:
authorAndy Staudacher <andy.st@gmail.com>2009-02-10 02:37:16 +0000
committerAndy Staudacher <andy.st@gmail.com>2009-02-10 02:37:16 +0000
commitc2eee4746533af10779934f705138fe9bb567550 (patch)
tree1b97e2e233906117db905bab5d5c2668bfc4c93c /core/libraries
parentdce6548431c4d61ab6c532375a0f030d8de72fd1 (diff)
Move site default_locale into DB (vars) and add a per user locale preference.
There's no UI to select the locale yet.
Diffstat (limited to 'core/libraries')
-rw-r--r--core/libraries/I18n.php8
1 files changed, 7 insertions, 1 deletions
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"