Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to Gettext.plural_keys #122

Merged
merged 4 commits into from May 14, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/i18n/gettext.rb
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]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

args.empty? would look better here imo.

end

def extract_scope(msgid, separator)
Expand Down