svenfuchs / adva_cms

cutting edge cms, blog, wiki, forum ...
http://adva-cms.org
MIT License
491 stars 74 forks source link

Translate failing under Rails 2.3.8 #13

Open dlineate opened 14 years ago

dlineate commented 14 years ago

When rails went from 2.3.5 => 2.3.8, activesupport's i18n library was bumped: activesupport-2.3.5/lib/active_support/vendor/i18n-0.1.3 => activesupport-2.3.8/lib/active_support/vendor/i18n-0.3.7

This has revealed what I think is a bad typo in engines/adva_cms/vendor/plugins/globalize2/lib/globalize/backend/static.rb:20 12:def translate(locale, key, options = {}) 13: result, default, fallback = nil, options.delete(:default), nil 14: I18n.fallbacks[locale].each do |fallback| 15: begin 16: result = super(fallback, key, options) and break 17: rescue I18n::MissingTranslationData 18: end 19: end 20: result ||= default locale, default, options

The last line makes no sense to me. I think it isn't reached in 2.3.5 but is in 2.3.8

The exception is: vendor/plugins/adva_cms/vendor/plugins/globalize2/lib/globalize/backend/static.rb:47:in []' vendor/plugins/adva_cms/vendor/plugins/globalize2/lib/globalize/backend/static.rb:47:intranslation' vendor/plugins/adva_cms/vendor/plugins/globalize2/lib/globalize/backend/static.rb:23:in translate' /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/vendor/i18n-0.3.7/i18n.rb:237:int'

Without fully understanding everything, the problem goes away if I change line 20 above: 20: result ||= default # locale, default, options

dlineate commented 14 years ago

Digging deeper, 'default' is also a function in the superclass I18n::Backend::Simple, and my above "fix" breaks the translate()'s :default option. No idea how to fix this then though unfortunately... Due to this and another HTML safe-encoding bug, I'll have to stay on 2.3.5 for awhile longer I guess.