Skip to content

Commit

Permalink
Giving further access to Gettext.plural_keys so at least an outside c…
Browse files Browse the repository at this point in the history
…an add more mappings than the :en default.
  • Loading branch information
Nikos Dimitrakopoulos committed Nov 10, 2011
1 parent 89ea337 commit f76bd01
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/i18n/gettext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ module Gettext
@@plural_keys = { :en => [:one, :other] }

class << self
# returns an array of plural keys for the given locale so that we can
# convert from gettext's integer-index based style
# returns an array of plural keys for the given locale or the whole hash
# of locale mappings to plural keys so that we can convert from gettext's
# integer-index based style
# TODO move this information to the pluralization module
def plural_keys(locale)
@@plural_keys[locale] || @@plural_keys[:en]
def plural_keys(*args)
args.length == 0 ? @@plural_keys : @@plural_keys[args.first] || @@plural_keys[:en]
end

def extract_scope(msgid, separator)
Expand Down

0 comments on commit f76bd01

Please sign in to comment.