module FrenchRails::Pluralization

Public Instance Methods

pluralize(locale, entry, count) click to toggle source

The French grammar rules are not the same that for English. In english, everything different than 1 is plural. In French everything strictly above -2 and below 2 is singular e.g -1.99, -1, 0, 1, 1.99

# File lib/french_rails/backend/simple.rb, line 11
def pluralize(locale, entry, count)
  return entry unless entry.is_a?(Hash) and count
  key = :zero if count == 0 && entry.has_key?(:zero)
  key ||= count.abs < 2 ? :one : :other
  raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
  entry[key]
end