class String
def pluralize(count = nil, locale = :en)
'ley'.pluralize(1, :es) # => "ley"
'ley'.pluralize(:es) # => "leyes"
'apple'.pluralize(2) # => "apples"
'apple'.pluralize(1) # => "apple"
'CamelOctopus'.pluralize # => "CamelOctopi"
'the blue mailman'.pluralize # => "the blue mailmen"
'words'.pluralize # => "words"
'sheep'.pluralize # => "sheep"
'octopus'.pluralize # => "octopi"
'post'.pluralize # => "posts"
You must define your own inflection rules for languages other than English.
By default, this parameter is set to :en.
the word will be pluralized as a word of that language.
If the optional parameter +locale+ is specified,
For any other value of +count+ the plural will be returned.
the singular form will be returned if count == 1.
If the optional parameter +count+ is specified,
Returns the plural form of the word in the string.
def pluralize(count = nil, locale = :en) locale = count if count.is_a?(Symbol) if count == 1 dup else ActiveSupport::Inflector.pluralize(self, locale) end end