diff options
| author | Andy Staudacher <andy.st@gmail.com> | 2009-02-09 08:42:13 +0000 |
|---|---|---|
| committer | Andy Staudacher <andy.st@gmail.com> | 2009-02-09 08:42:13 +0000 |
| commit | dce6548431c4d61ab6c532375a0f030d8de72fd1 (patch) | |
| tree | 2f39eda105cc270f80580452ab36fac72b6a1375 /core/libraries | |
| parent | fa1f49d99a30a029d1a4e09b820c639d639f6283 (diff) | |
Add local localization functionality. Local = no means to upload / download translations to a translation server yet.
- Added an outgoing_translations table to store translations from the local translation UI.
- I18n class is checking incoming_ and outgoing_translations for translations, giving the latter priority.
- Not handling plural strings in the translations UI yet.
Diffstat (limited to 'core/libraries')
| -rw-r--r-- | core/libraries/I18n.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/libraries/I18n.php b/core/libraries/I18n.php index 51bc2a51..19215325 100644 --- a/core/libraries/I18n.php +++ b/core/libraries/I18n.php @@ -101,6 +101,10 @@ class I18n_Core { return $entry; } + public function getLocale() { + return $this->_config['default_locale']; + } + private function lookup($locale, $message) { if (!isset($this->_cache[$locale])) { $this->_cache[$locale] = array(); @@ -113,6 +117,16 @@ class I18n_Core { ->as_array() as $row) { $this->_cache[$locale][$row->key] = unserialize($row->translation); } + + // Override incoming with outgoing... + foreach (Database::instance() + ->select("key", "translation") + ->from("outgoing_translations") + ->where(array("locale" => $locale)) + ->get() + ->as_array() as $row) { + $this->_cache[$locale][$row->key] = unserialize($row->translation); + } } $key = self::getMessageKey($message); |
