Module: I18n::Gettext

Defined in:
lib/i18n/gettext.rb

Constant Summary collapse

PLURAL_SEPARATOR =
"\001"
CONTEXT_SEPARATOR =
"\004"
@@plural_keys =
{ :en => [:one, :other] }

Class Method Summary collapse

Class Method Details

.extract_scope(msgid, separator = nil) ⇒ Object



16
17
18
19
20
# File 'lib/i18n/gettext.rb', line 16

def extract_scope(msgid, separator = nil)
  scope = msgid.to_s.split(separator || '|')
  msgid = scope.pop
  [scope, msgid]
end

.plural_keys(locale) ⇒ Object

returns an array of plural keys for the given locale so that we can convert from gettext’s integer-index based style TODO move this information to the pluralization module



12
13
14
# File 'lib/i18n/gettext.rb', line 12

def plural_keys(locale)
  @@plural_keys[locale] || @@plural_keys[:en]
end