Sha256: 198d1ab98a40606d495578426a9389a99c61fff961426e5f3e00357dfd0fe3ba

Contents?: true

Size: 780 Bytes

Versions: 114

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

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

    autoload :Helpers, 'i18n/gettext/helpers'

    @@plural_keys = { :en => [:one, :other] }

    class << self
      # 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(*args)
        args.empty? ? @@plural_keys : @@plural_keys[args.first] || @@plural_keys[:en]
      end

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

Version data entries

114 entries across 100 versions & 25 rubygems

Version Path
i18n-1.14.6 lib/i18n/gettext.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.5/lib/i18n/gettext.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/gettext.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/i18n-1.14.5/lib/i18n/gettext.rb
i18n-1.14.5 lib/i18n/gettext.rb
i18n-1.14.4 lib/i18n/gettext.rb
i18n-1.14.3 lib/i18n/gettext.rb
mlh-rubocop-config-1.0.3 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.10.0/lib/i18n/gettext.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.12.0/lib/i18n/gettext.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
mlh-rubocop-config-1.0.2 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
fablicop-1.10.3 vendor/bundle/ruby/3.2.0/gems/i18n-1.14.1/lib/i18n/gettext.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/i18n-1.12.0/lib/i18n/gettext.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/i18n-1.14.1/lib/i18n/gettext.rb