Skip to content

Commit

Permalink
Rename I18n to Gallery_I18n to avoid conflict with Kohana 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
bharat committed Nov 25, 2009
1 parent 9b6663f commit 3ed7a5a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions modules/gallery/controllers/l10n_client.php
Expand Up @@ -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");

Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/helpers/l10n_scanner.php
Expand Up @@ -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];
}
Expand Down
6 changes: 3 additions & 3 deletions modules/gallery/helpers/locales.php
Expand Up @@ -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"));
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/gallery/hooks/init_gallery.php
Expand Up @@ -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"));
Expand Down
Expand Up @@ -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);
}

/**
Expand All @@ -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();
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions modules/gallery/tests/I18n_Test.php
Expand Up @@ -18,15 +18,15 @@
* 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() {
$config = array(
'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")
Expand All @@ -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';
Expand Down

0 comments on commit 3ed7a5a

Please sign in to comment.