instance method pluralize

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.2.3

Signature

pluralize(locale, entry, count)

Picks a translation from an array according to English pluralization rules. It will pick the first translation if count is not equal to 1 and the second translation if it is equal to 1. Other backends can implement more flexible or complex pluralization rules.

Parameters

locale req
entry req
count req
Source
# File activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb, line 128
        def pluralize(locale, entry, count)
          return entry unless entry.is_a?(Hash) and count
          # raise InvalidPluralizationData.new(entry, count) unless entry.is_a?(Hash)
          key = :zero if count == 0 && entry.has_key?(:zero)
          key ||= count == 1 ? :one : :other
          raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
          entry[key]
        end

Defined in activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb line 128 · View on GitHub · Improve this page · Find usages on GitHub

Defined in I18n::Backend::Simple

Type at least 2 characters to search.

↑↓ navigate · open · esc close