Package: liblocale-rails-ruby1.8 Version: 2.0.5-2 Severity: grave Tags: patch
Coin,I recently upgraded an application using the new split rails 2.3.5-1, and gettext for translations, so i installed this package to get rails translated. The app complained about missing methods, and after looking at the problem, i found libi18n-ruby1.8 provides a Locale class in the I18n namespace, and liblocale-rails-ruby1.8 is also in this namespace when it calls the Locale class, but it is requiring 'locale' in '/usr/lib/ruby/1.8/locale_rails.rb', so the Locale class wanted is not I18n::Locale but ::Locale provided by liblocale-ruby1.8 (and the wanted methods match).
The following patch fixes this issue, even if the use of the I18n namespace should probably be sorted out.
Regards. -- Marc Dequènes (Duck)
--- /usr/lib/ruby/1.8/locale_rails/i18n.rb.orig 2010-07-11 17:09:41.000000000 +0200 +++ /usr/lib/ruby/1.8/locale_rails/i18n.rb 2010-07-11 17:11:23.000000000 +0200 @@ -13,35 +13,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. # 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. # 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 @@ -50,7 +50,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
pgp5hVIpbIEA6.pgp
Description: PGP Digital Signature