This project is archived and is in readonly mode.
interning empty string
-
Nicholas Faiz
Provoking the error from a debugger breakpoint:
ArgumentError: interning empty string from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n.rb:196:in `to_sym' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n.rb:196:in `normalize_translation_keys' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n.rb:196:in `map' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n.rb:196:in `normalize_translation_keys' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n/backend/simple.rb:101:in `send' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n/backend/simple.rb:101:in `lookup' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n/backend/simple.rb:33:in `translate' from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.0/lib/active_support/vendor/i18n-0.1.1/lib/i18n.rb:165:in `translate' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.0/lib/active_record/validations.rb:110:in `generate_message' from /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.3.0/lib/active_record/validations.rb:48:in `add' from (irb):3:in `send' -
Nicholas Faiz
Here's a workaround:
errors.add(msg, "invalid")The normalize_transaction_keys in i18n.rb wasn't protecting itself from nils. Adding a nil check in stopped the error:
def normalize_translation_keys(locale, key, scope) keys = [locale] + Array(scope) + [key] keys = keys.map { |k| k.to_s.split(/\./) } keys.flatten.map { |k| if k then k.to_sym end } end endIt was evidently trying to convert a nil or "" into a sym.
-
Nicholas Faiz
Sorry, this was on 2.3 rc1
-
Pratik
- State changed from new to wontfix
Can't reproduce. Could you please submit a failng test case ? http://guides.rails.info/contrib... might be helpful as well.
Thanks !
-
Evgeniy Dolzhenko
- Tag set to activesupport, i18n
- Assigned user set to Pratik
Confirmed the issue. Can be easily illustrated from console:
>> I18n.translate(".1.") ArgumentError: interning empty string from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:197:in `to_sym' from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:197:in `normalize_translation_keys' from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:197:in `map' from /opt/ruby-enterprise-1.8.6-20090610/lib/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:197:in `normalize_translation_keys'Attached patch with the test case and fix.
-
Wildgoose
Not sure why this is still "won't fix"? Can we please re-open? It seems that this is also the clue to my bug:
I find using a custom validation message with a ".." in it breaks rails 2.3.4
eg:
validates_inclusion_of :pager_msg_size, :in => 30..500, :message => "enter range between 30..500"I can also see this in the console:
I18n.translate("enter 1..2") ArgumentError: interning empty string
from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:196:in `to_sym' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:196:in `normalize_translation_keys' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:196:in `map' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:196:in `normalize_translation_keys' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:101:in `send' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:101:in `lookup' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n/backend/simple.rb:33:in `translate' from /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.4/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:165:in `translate' from (irb):8 -
Jeremy Kemper
It's wontfix because it's a bug in the bundled i18n library.
-
Evgeniy Dolzhenko
- Tag cleared.
Ok, does that mean it should be reported here http://i18n.lighthouseapp.com/projects/14947-ruby-i18n/tickets ?
