Sha256: 9a90fcbce8dff8f6f15a563c0303eea7afd27669e3cb9f46069f68a4d6792082
Contents?: true
Size: 976 Bytes
Versions: 1
Compression:
Stored size: 976 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Formatters module Plurals class Rules class << self def all all_for(TwitterCldr::get_locale) end def all_for(locale) locale = TwitterCldr.convert_locale(locale.to_sym) get_resource(locale)[locale][:i18n][:plural][:keys] rescue => e [] end def rule_for(number, locale = TwitterCldr::get_locale) locale = TwitterCldr.convert_locale(locale.to_sym) get_resource(locale)[locale][:i18n][:plural][:rule].call(number) rescue => e :other end protected def get_resource(locale) locale = TwitterCldr.convert_locale(locale) eval(TwitterCldr.get_resource(locale, "plurals")[locale]) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twitter_cldr-1.1.0 | lib/formatters/plurals/rules.rb |