Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 25 lines (21 sloc) 0.644 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
# encoding: utf-8

module I18n
  module Gettext
    PLURAL_SEPARATOR = "\001"
    CONTEXT_SEPARATOR = "\004"

    @@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
      # TODO move this information to the pluralization module
      def plural_keys(locale)
        @@plural_keys[locale] || @@plural_keys[:en]
      end

      def extract_scope(msgid, separator = nil)
        scope = msgid.to_s.split(separator || '|')
        msgid = scope.pop
        [scope, msgid]
      end
    end
  end
end
Something went wrong with that request. Please try again.