diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php index 6db67d3b61..3801e6aaad 100644 --- a/modules/gallery/controllers/l10n_client.php +++ b/modules/gallery/controllers/l10n_client.php @@ -24,7 +24,7 @@ public function save() { access::forbidden(); } - $locale = I18n::instance()->locale(); + $locale = Gallery_I18n::instance()->locale(); $input = Input::instance(); $key = $input->post("l10n-message-key"); @@ -36,7 +36,7 @@ public function save() { if (!$root_message->loaded) { throw new Exception("@todo bad request data / illegal state"); } - $is_plural = I18n::is_plural_message(unserialize($root_message->message)); + $is_plural = Gallery_I18n::is_plural_message(unserialize($root_message->message)); if ($is_plural) { $plural_forms = l10n_client::plural_forms($locale); @@ -122,9 +122,9 @@ public static function l10n_form() { $calls[$row->key] = array(unserialize($row->message), array()); } } else { - $calls = I18n::instance()->call_log(); + $calls = Gallery_I18n::instance()->call_log(); } - $locale = I18n::instance()->locale(); + $locale = Gallery_I18n::instance()->locale(); if ($calls) { $translations = array(); diff --git a/modules/gallery/helpers/l10n_scanner.php b/modules/gallery/helpers/l10n_scanner.php index a8059b3aaf..e36d419dc3 100644 --- a/modules/gallery/helpers/l10n_scanner.php +++ b/modules/gallery/helpers/l10n_scanner.php @@ -37,7 +37,7 @@ static function process_message($message, &$cache) { } } - $key = I18n::get_message_key($message); + $key = Gallery_I18n::get_message_key($message); if (array_key_exists($key, $cache)) { return $cache[$key]; } diff --git a/modules/gallery/helpers/locales.php b/modules/gallery/helpers/locales.php index 2de029ffae..8d76e33333 100644 --- a/modules/gallery/helpers/locales.php +++ b/modules/gallery/helpers/locales.php @@ -125,13 +125,13 @@ static function display_name($locale=null) { if (empty(self::$locales)) { self::_init_language_data(); } - $locale or $locale = I18n::instance()->locale(); + $locale or $locale = Gallery_I18n::instance()->locale(); return self::$locales["$locale"]; } static function is_rtl($locale=null) { - $locale or $locale = I18n::instance()->locale(); + $locale or $locale = Gallery_I18n::instance()->locale(); list ($language, $territory) = explode('_', $locale . "_"); return in_array($language, array("he", "fa", "ar")); } @@ -233,7 +233,7 @@ static function set_request_locale() { } // If we have any preference, override the site's default locale if ($locale) { - I18n::instance()->locale($locale); + Gallery_I18n::instance()->locale($locale); } } diff --git a/modules/gallery/hooks/init_gallery.php b/modules/gallery/hooks/init_gallery.php index b2d9c4dee4..4ce9bab4dd 100644 --- a/modules/gallery/hooks/init_gallery.php +++ b/modules/gallery/hooks/init_gallery.php @@ -24,7 +24,7 @@ url::redirect(url::abs_file("installer")); } -Event::add("system.ready", array("I18n", "instance")); +Event::add("system.ready", array("Gallery_I18n", "instance")); Event::add("system.ready", array("module", "load_modules")); Event::add("system.ready", array("gallery", "ready")); Event::add("system.post_routing", array("url", "parse_url")); diff --git a/modules/gallery/libraries/I18n.php b/modules/gallery/libraries/Gallery_I18n.php similarity index 98% rename from modules/gallery/libraries/I18n.php rename to modules/gallery/libraries/Gallery_I18n.php index c333605210..0571fe585e 100644 --- a/modules/gallery/libraries/I18n.php +++ b/modules/gallery/libraries/Gallery_I18n.php @@ -27,7 +27,7 @@ * @return String The translated message string. */ function t($message, $options=array()) { - return I18n::instance()->translate($message, $options); + return Gallery_I18n::instance()->translate($message, $options); } /** @@ -43,11 +43,11 @@ function t($message, $options=array()) { * @return String The translated message string. */ function t2($singular, $plural, $count, $options=array()) { - return I18n::instance()->translate(array("one" => $singular, "other" => $plural), + return Gallery_I18n::instance()->translate(array("one" => $singular, "other" => $plural), array_merge($options, array("count" => $count))); } -class I18n_Core { +class Gallery_I18n_Core { private static $_instance; private $_config = array(); private $_call_log = array(); @@ -64,7 +64,7 @@ public static function instance($config=null) { if (empty($config['default_locale'])) { $config['default_locale'] = module::get_var('gallery', 'default_locale'); } - self::$_instance = new I18n_Core($config); + self::$_instance = new Gallery_I18n_Core($config); } return self::$_instance; diff --git a/modules/gallery/tests/I18n_Test.php b/modules/gallery/tests/I18n_Test.php index 9010606a91..d0555cbf0e 100644 --- a/modules/gallery/tests/I18n_Test.php +++ b/modules/gallery/tests/I18n_Test.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class I18n_Test extends Unit_Test_Case { +class Gallery_I18n_Test extends Unit_Test_Case { private $i18n; public function setup() { @@ -26,7 +26,7 @@ public function setup() { 'root_locale' => 'en', 'default_locale' => 'te_ST', 'locale_dir' => VARPATH . 'locale/'); - $this->i18n = I18n::instance($config); + $this->i18n = Gallery_I18n::instance($config); ORM::factory("incoming_translation") ->where("locale", "te_ST") @@ -43,7 +43,7 @@ public function setup() { foreach ($messages_te_ST as $data) { list ($message, $translation) = $data; $entry = ORM::factory("incoming_translation"); - $entry->key = I18n::get_message_key($message); + $entry->key = Gallery_I18n::get_message_key($message); $entry->message = serialize($message); $entry->translation = serialize($translation); $entry->locale = 'te_ST';