diff --git a/lib/countries/translations.rb b/lib/countries/translations.rb index 6463d4136..eca88f190 100644 --- a/lib/countries/translations.rb +++ b/lib/countries/translations.rb @@ -1,4 +1,9 @@ module ISO3166 + # Extend the hash class to allow locale lookup fall back behavior + # + # ex: + # if a country has translations for pt, and the user looks up `pt-br` fallback + # to `pt` to prevent from showing nil values class Translations < Hash def [](locale) super(locale) || super(locale.sub(/-.*/, ""))