Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate failing under Rails 2.3.8 #13

Open
dlineate opened this issue Jul 7, 2010 · 1 comment
Open

Translate failing under Rails 2.3.8 #13

dlineate opened this issue Jul 7, 2010 · 1 comment

Comments

@dlineate
Copy link

dlineate commented Jul 7, 2010

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant