Sha256: 4730a0363ba71e2c1b7d1dba200f262bd41e45d19e2ed1bd12087412ddef6595
Contents?: true
Size: 375 Bytes
Versions: 18
Compression:
Stored size: 375 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(locale) || super(locale.to_s.sub(/-.*/, '')) end end end
Version data entries
18 entries across 18 versions & 1 rubygems