using rb files for locales

config/locales/en.rb

en:
hello: “Hello world”

Rails complains unexpected : expecting end of input at the first :

en.yml

That’s not a valid answer Moderator please remove his answer

That’s not a valid answer Moderator please remove his answer

The answer that was given to you was more than valid, but you weren’t able to read it correctly. The code you showed us was obviously YAML, therefore the file ending should have been yml, as pointed out. Of course, as far as I remember there are ways to use ruby files for localisation, but then you have to use ruby syntax, not YAML.

Also this is a mailinglist, and the mods do not have access to my personal mailbox, I hope at least :wink: Therefore deletion is rather useless. But you are free to delete the mails you received in your personal mailbox.

The rails docs say i can use rb or yml but they don’t say what the syntax for rb should be They do say rb is preferable because it’ll break with errors where yml will leave you guessing why things aren’t being displayed as you expected, so I wanted to know the right rb syntax

So not the answer has been a bad one but your question was.

I’ve never used I18N and L21N in rails. So I can’t help you with that.

Rails guides say this

You may use YAML (.yml) or plain Ruby (.rb) files for storing your translations in SimpleStore

So it seems as if you just need to write a script that modifies some simple store called thing, you might try to find documentation about that.

The very same guides do also state that yaml is preferred but has downsides…

What doc says that? Certainly not this one:

  http://guides.rubyonrails.org/i18n.html

which also includes an example of using Ruby rather than YAML

  http://guides.rubyonrails.org/i18n.html#how-to-store-your-custom-translations

http://guides.rubyonrails.org/i18n.html:
You may use YAML (.yml) or plain Ruby (.rb )
files for storing your translations in SimpleStore. YAML is the preferred option among Rails developers. However, it has one big disadvantage. YAML is very sensitive to whitespace and special characters, so the application may not load your dictionary properly. Ruby files will crash your application on first request, so you may easily find what’s wrong. (If you encounter any “weird issues” with YAML
dictionaries, try putting the relevant portion of your dictionary into a
Ruby file.)

If your translations are stored in YAML files, certain keys must be escaped. They are:

  • true, on, yes
  • false, off, no