Sha256: 8e8109970805ba3c30a468b388091a4a48030a9027379a924c734aee82283cbf
Contents?: true
Size: 753 Bytes
Versions: 13
Compression:
Stored size: 753 Bytes
Contents
class ISO::Language < ISO::Subtag DEFINITIONS_FILE = "#{File.dirname(__FILE__)}/../../data/iso-639-1.yml" DEFAULT_PLURAL_RULE_NAMES = %w(one other) DEFAULT_DIRECTION = 'ltr' DEFAULT_CODE = 'en' PLURAL_RULE_NAMES = %w(zero one two few many other) attr_reader :plural_rule_names, :direction def initialize(code, options={}) @plural_rule_names = options[:plural_rule_names] || DEFAULT_PLURAL_RULE_NAMES @direction = options[:direction] || DEFAULT_DIRECTION super(code, options) end def self.identify(full_code) segments = full_code.split('-') segments.first =~ /^([a-z]{2})$/ ? find($1) : nil end private def i18n_scope super << ".languages" end end
Version data entries
13 entries across 13 versions & 1 rubygems