Skip to content

Instantly share code, notes, and snippets.

@poppen
Created September 10, 2010 01:12
Show Gist options
  • Save poppen/572885 to your computer and use it in GitHub Desktop.
Save poppen/572885 to your computer and use it in GitHub Desktop.
patch for locale_rails-2.0.4
--- i18n.rb.orig 2010-09-10 10:06:32.000000000 +0900
+++ i18n.rb 2010-09-10 10:07:16.000000000 +0900
@@ -14,35 +14,35 @@
# Gets the supported locales.
def supported_locales
- Locale.app_language_tags
+ ::Locale.app_language_tags
end
# Sets the supported locales.
# I18n.set_supported_locales("ja-JP", "ko-KR", ...)
def set_supported_locales(*tags)
- Locale.set_app_language_tags(*tags)
+ ::Locale.set_app_language_tags(*tags)
end
# Sets the supported locales as an Array.
# I18n.supported_locales = ["ja-JP", "ko-KR", ...]
def supported_locales=(tags)
- Locale.set_app_language_tags(*tags)
+ ::Locale.set_app_language_tags(*tags)
end
- # Sets the locale.
+ # Sets the ::Locale.
# I18n.locale = "ja-JP"
def locale=(tag)
- Locale.clear
- tag = Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol
- Locale.current = tag
- Thread.current[:locale] = Locale.candidates(:type => :rfc)[0]
+ ::Locale.clear
+ tag = ::Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol
+ ::Locale.current = tag
+ Thread.current[:locale] = ::Locale.candidates(:type => :rfc)[0]
end
- # Sets the default locale.
+ # Sets the default ::Locale.
# I18n.default_locale = "ja"
def default_locale=(tag)
- tag = Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol
- Locale.default = tag
+ tag = ::Locale::Tag::Rfc.parse(tag.to_s) if tag.kind_of? Symbol
+ ::Locale.default = tag
@@default_locale = tag
end
@@ -51,7 +51,7 @@
# MissingTranslationData is overrided to fallback messages in candidate locales.
def locale_rails_exception_handler(exception, locale, key, options) #:nodoc:
ret = nil
- Locale.candidates(:type => :rfc).each do |loc|
+ ::Locale.candidates(:type => :rfc).each do |loc|
begin
ret = backend.translate(loc, key, options)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment