ruby-i18n/i18n

[BUG] Cannot look up keys that end in `.0`

movermeyer opened this issue · 0 comments

What I tried to do

#457 introduced a bug where 0 was no longer considered an integer, and so lookups of .0 keys fail:

(byebug) I18n.normalize_keys(:se, "fields.day.relative.0", nil, nil)
[:se, :fields, :day, :relative, :"0"]
(byebug) I18n.normalize_keys(:se, "fields.day.relative.1", nil, nil)
[:se, :fields, :day, :relative, 1]

Note that 1 gets normalized as an Integer, but 0 does not.

What I expected to happen

0 would get parsed as an integer.

What actually happened

0 gets parsed as a symbol

Versions of i18n, rails, and anything else you think is necessary

Tested with v1.8.11, present since v1.5.1

Potential solution?

Could fix the regex to include 0. PR incoming.