Skip to content

Instantly share code, notes, and snippets.

@kirkgo
Last active June 5, 2018 19:17
Show Gist options
  • Save kirkgo/1978234 to your computer and use it in GitHub Desktop.
Save kirkgo/1978234 to your computer and use it in GitHub Desktop.
Pluralization in brazilian portuguese through REGEX for Ruby on Rails
ActiveSupport::Inflector.inflections do |inflect|
inflect.plural /ao$/i, 'oes'
inflect.singular /oes$/i, 'ao'
inflect.plural /l$/i, 'is'
inflect.singular /is$/i, 'l'
inflect.plural /or$/i, 'ores'
inflect.singular /ores$/i, 'or'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment