I18n.t('countries.NO') broken?

28 views
Skip to first unread message

Sven Schwyn

unread,
Mar 31, 2012, 7:19:38 AM3/31/12
to rubyonra...@googlegroups.com
Hi

I've tried this on a virgin Rails 3.2.2 app. If you put the translations
for country names in the locale file using the 2 letter ISO code, it
looks something like this:

en:
countries:
DE: "Germany"
NO: "Norway"
US: "USA"

This works fine - but for Norway :-)

I18n.t :'countries.DE' # => "Germany"
I18n.t :'countries.NO' # => "translation missing: en.countries.NO"

Case doesn't matter, the same happens with :'countries.no'.

Any idea what could be the cause for this problem?

Thanks!

--
Posted via http://www.ruby-forum.com/.

Tim Shaffer

unread,
Apr 1, 2012, 6:04:46 AM4/1/12
to rubyonra...@googlegroups.com
"no" is a reserved word. You will need to enclose it in quotes.

"NO": Nope

Rob Biedenharn

unread,
Apr 2, 2012, 2:25:22 AM4/2/12
to rubyonra...@googlegroups.com
There are "optimizations" in YAML for YES and NO. Define it this way:

en:
countries:
DE: "Germany"
"NO": "Norway"
US: "USA"

and it should work for you.

-Rob

> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonra...@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>

Reply all
Reply to author
Forward
0 new messages