Skip to content

Commit

Permalink
Specify country mappings
Browse files Browse the repository at this point in the history
Fix #404
  • Loading branch information
radar committed May 14, 2014
1 parent 26c4557 commit 63d6df7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions config/initializers/country_names.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,30 @@ def lookup(locale, key, scope=[], options={})
end

I18n.backend = I18n::Backend::Chain.new(I18n::Backend::I18nDataBackend.new, I18n.backend)


module I18nData

private
def self.normal_to_region_code(normal)
country_mappings = {
"DE-CH" => "de",
"FR-CH" => "fr",
"EN-AU" => "en",
"EN-GB" => "en",
"EN-US" => "en",
"EN-IN" => "en",
"EN-NZ" => "en",
"ES-CL" => "es",
"ES-EC" => "es",
"ES-MX" => "es",
"PT-BR" => "pt",
"SL-SI" => "sl",
"ZH-TW" => "zh_CN",
"ZH-CN" => "zh_CN",
"ZH" => "zh_CN",
"BN" => "bn_IN",
}
country_mappings[normal] || normal
end
end

0 comments on commit 63d6df7

Please sign in to comment.