views:

134

answers:

1

Hi,

I'm trying to switch one of my websites into en-UK so that I get the correct date and currency formats etc...

I have found this yaml file:

http://github.com/mattetti/globalite/blob/master/lang/rails/en-UK.yml

Any ideas if there is a better one to use?

I also checked here but could not see it:

http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale

Thanks, Nick

A: 

I have found a better solution than to keep a duplicate version of en.yml and simply change the $ to £.

There is a plugin that lets you only override the values you require:

http://github.com/javan/rails-i18n-translation-inheritance-helper

config/environment.rb

config.i18n.default_locale = 'en-UK'

and then create:

config/locales/en-UK.yml - for special cases

en-UK:
  number:
    currency:
      format:
        unit: '£'
        format: '%u%n'

config/locales/en.yml - for all English translations

en:
 btn_submit: Submit

This works a treat and will also mean that I don't need to maintain the file apart from any special cases like above.

View

=t 'btn_submit' #Submit
=h number_to_currency(@price, :precision => 0) #£1,000

Hope this helps others as it took a while to find a solution.

Nick Clarke