From dce6548431c4d61ab6c532375a0f030d8de72fd1 Mon Sep 17 00:00:00 2001 From: Andy Staudacher Date: Mon, 9 Feb 2009 08:42:13 +0000 Subject: 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. --- core/libraries/I18n.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core/libraries') 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); -- cgit v1.2.3