gettext.rb 656 B

12345678910111213141516171819202122232425
  1. module I18n
  2. module Gettext
  3. PLURAL_SEPARATOR = "\001"
  4. CONTEXT_SEPARATOR = "\004"
  5. autoload :Helpers, 'i18n/gettext/helpers'
  6. @@plural_keys = { :en => [:one, :other] }
  7. class << self
  8. # returns an array of plural keys for the given locale so that we can
  9. # convert from gettext's integer-index based style
  10. # TODO move this information to the pluralization module
  11. def plural_keys(locale)
  12. @@plural_keys[locale] || @@plural_keys[:en]
  13. end
  14. def extract_scope(msgid, separator)
  15. scope = msgid.to_s.split(separator)
  16. msgid = scope.pop
  17. [scope, msgid]
  18. end
  19. end
  20. end
  21. end