module ActiveSupport::Inflector

def apply_inflections(word, rules, locale = :en)

apply_inflections('posts', inflections.singulars, :en) # => "post"
apply_inflections('post', inflections.plurals, :en) # => "posts"

found for that locale.
If passed an optional +locale+ parameter, the uncountables will be

Applies inflection rules for +singularize+ and +pluralize+.
def apply_inflections(word, rules, locale = :en)
  result = word.to_s.dup
  if word.empty? || inflections(locale).uncountables.uncountable?(result)
    result
  else
    rules.each { |(rule, replacement)| break if result.sub!(rule, replacement) }
    result
  end
end