Portuguese Plural Rules plugin

Portuguese FlagI’m proud to present the Portuguese Plural rules Plugin for Ruby on Rails (Version 1.0 beta)

This is a basic implementation of portuguese pluralization rules, more “convention over configuration” for all of you who want to use table names and models in portuguese. The plugin comes with documentation and test cases.
To use:
Copy the plugin to your project/vendor/plugin/ directory and just create your tables and models as normal.
You can also test if a word gets correctly pluralized by:

1) running “ruby script/console”
2) write “palavra”.pluralize
3) or “palavra”.singularize

TODO
1) Add rules and examples for the following:
-if word ends in “s” and has one silable, trade “s” with “es”

2) Improve list of irregular words for the following rule:
-if word ends in “ão”, there are three ways of plural: ãos, ães, ões

These rules depend on the number of syllables, so that might help a bit, but I’m no expert in Regex.

3) Add cases of uncountable words to the list

4) Fix other unknown bugs.

5) Improve test cases

DOWNLOAD
I haven’t setup SVN yet so the only way to download (for now) is by download from here.

Enjoy and don’t forget to send me some feedback. :)

4 thoughts on “Portuguese Plural Rules plugin

  1. Muralha

    @psousa, quando tiver um pouco de tempo e paciência para ir Github, ponho lá.

    Já agora, não sei se é das últimas versões do Rails ou se é por estar a utilizar a Ruby Enterprise Edition, mas a pasta plugins desapareceu, agora é colocado no config/initializers/inflections.rb .

Comments are closed.