Reputation: 443
I'd like to retrieve the current locale of my Rails application in ISO 15897 format.
Any way to format the current locale into this format?
Upvotes: 1
Views: 263
Reputation: 18784
Can you maintain a map internally of locales you actually support?
Something like this:
def locale_iso15897(locale)
iso_map = {
"en" => "en_US.UTF8",
"fr" => "fr_FR.UTF8",
"fr-CA" => "fr_CA.UTF8",
"pl" => "pl_PL.UTF8"
}
iso_map[locale.to_s]
end
Upvotes: 2