Jetblackstar
Jetblackstar

Reputation: 249

rails i18n en-GB and Rails 4 depreciated warning. How should I handle en-GB properly?

So like many I've walked into the Depreciated warning of

[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

I have read how to disable the warning, but I would rather get this correct.

I am British, the Application I'm writing is for a British client. So I have set the default :locale to en-GB. From what I read in http://guides.rubyonrails.org/i18n.html en-GB is probably not counted as a valid locale? Is that right?

I was hoping that would get me "£" and English dates.

What is the proper way of handling en-GB locality's within my application? Should I be setting to :en and overriding my en values in config for &pound signs and english dates?

Or can I add en-GB as an official locale that Rails likes somehow?

Upvotes: 2

Views: 277

Answers (2)

Tadas Sasnauskas
Tadas Sasnauskas

Reputation: 2313

en-GB is still a valid locale. You get a warning because en-GB locale data is nowhere to be found in locale load paths. For some basic en-GB defaults like currency sign and numeric separators install rails-i18n gem.

Upvotes: 0

bert bruynooghe
bert bruynooghe

Reputation: 3093

I don't see why you think en-GB wouldn't be a valid locale: the guide merely states that they took a pragmatic approach to omit the region part. en-GB looks very valid to me, and also the rails-i18n gem supports it.

Also looking myself for a way to consider en as en-GB though...

Upvotes: 1

Related Questions