Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

i18n-0.1.3 fails with 'interning empty string' in i18n.rb:196

#3447

i18n-0.1.3 fails with...

  interning empty string
  [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/vendor/i18n-0.1.3/lib/i18n.rb:196:in `to_sym'

...in i18n.rb:196 when calling model.errors[:field] after having called model.errors.add(:field, 'custom message with two or more consecutive periods .. in the middle')

This is because split(/\./) with return at least one empty string when two or more consecutive periods appear in the middle or at the beginning of the string to be split.

      keys = [locale] + Array(scope) + [key]
      keys = keys.map { |k| k.to_s.split(/\./) }
      keys.flatten.map { |k| k.to_sym }

should probably be changed to something like:

      keys = [locale] + Array(scope) + [key]
      keys = keys.map { |k| k.to_s.split(/\./) }
      keys.flatten.reject(&:empty?).map { |k| k.to_sym }

...or change the regexp to /\.+/ etc.

Cheers,
V.

Reported by Vlad R · November 1st, 2009 @ 06:26 AM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)
    • State changed from new to stale

    Problem isn't exist anymore in i18n 0.3.3.

    January 20th, 2010 @ 05:19 PM

  2. Prem Sichanugrist (sikachu)
    Prem Sichanugrist (sikachu)
    • State changed from stale to resolved

    January 20th, 2010 @ 05:27 PM

  3. bingbing