class String
def singularize(locale = :en)
'leyes'.singularize(:es) # => "ley"
'CamelOctopi'.singularize # => "CamelOctopus"
'the blue mailmen'.singularize # => "the blue mailman"
'word'.singularize # => "word"
'sheep'.singularize # => "sheep"
'octopi'.singularize # => "octopus"
'posts'.singularize # => "post"
You must define your own inflection rules for languages other than English.
By default, this parameter is set to :en.
the word will be singularized as a word of that language.
If the optional parameter +locale+ is specified,
The reverse of +pluralize+, returns the singular form of a word in a string.
def singularize(locale = :en) ActiveSupport::Inflector.singularize(self, locale) end