开发者

Missing en-UK.yml file for Rails app

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开发者_C百科/svenfuchs/rails-i18n/tree/master/rails/locale

Thanks, Nick


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.


I think you're looking for en-GB :)

https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en-GB.yml

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜