summaryrefslogtreecommitdiff
path: root/core
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
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')
-rw-r--r--core/config/locale.php14
-rw-r--r--core/helpers/core_installer.php1
-rw-r--r--core/libraries/I18n.php8
3 files changed, 11 insertions, 12 deletions
diff --git a/core/config/locale.php b/core/config/locale.php
index d9f95664..3cea9178 100644
--- a/core/config/locale.php
+++ b/core/config/locale.php
@@ -40,15 +40,7 @@ $config['timezone'] = '';
* The locale of the built-in localization messages (locale of strings in translate() calls).
* This can't be changed easily, unless all localization strings are replaced in all source files
* as well.
+ * Although the actual root is "en_US", the configured root is "en" that all en locales inherit the
+ * built-in strings.
*/
-$config['root_locale'] = 'en';
-
-/**
- * The default locale of this installation.
- */
-$config['default_locale'] = 'en_US';
-
-/**
- * The path to the folder with translation files.
- */
-$config['locale_dir'] = VARPATH . 'locale/'; \ No newline at end of file
+$config['root_locale'] = 'en'; \ No newline at end of file
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php
index 7a83ec8f..e0747d46 100644
--- a/core/helpers/core_installer.php
+++ b/core/helpers/core_installer.php
@@ -207,6 +207,7 @@ class core_installer {
module::set_var("core", "page_size", 9);
module::set_var("core", "thumb_size", 200);
module::set_var("core", "resize_size", 640);
+ module::set_var("core", "default_locale", "en_US");
// Add rules for generating our thumbnails and resizes
graphics::add_rule(
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"