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

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:
    NO: "Norway"
    US: "USA"

This works fine - but for Norway :slight_smile:

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!

"no" is a reserved word. You will need to enclose it in quotes.

"NO": Nope

There are "optimizations" in YAML for YES and NO. Define it this way:

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

and it should work for you.

-Rob