Sha256: dbca890d1e8cec75804db0209693f90c907a19ac919ee7f865f2fbe2d2d80a3d
Contents?: true
Size: 367 Bytes
Versions: 3
Compression:
Stored size: 367 Bytes
Contents
# frozen_string_literal: true module ISO3166 # Extend the hash class to allow locale lookup fall back behavior # # E.g. 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 || super(locale.to_s.sub(/-.*/, '')) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
countries-7.1.1 | lib/countries/translations.rb |
countries-7.1.0 | lib/countries/translations.rb |
countries-7.0.0 | lib/countries/translations.rb |