views:

198

answers:

1

I am building apps for a non-english audience. Right now, I use english nouns to name my models, yet I prefer to use native dutch ones. As the convention uses the plural of the class name for tables, I assume it is the pluralize method inside Rails (where it resides, I wouldn't know). How can I change the pluralize method and where is it located? Would this break Rails?

I am using Rails 2.3.5 and Ruby 1.8.7

Example: The Book class becomes books now. My Boek class becomes boeks, but it is grammatically correct to use boeken

+2  A: 

Add your rules to an inflections.rb file in config/initializers. See the API documentation:

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'boek', 'boeken'
end
Christian Lescuyer
I remember briefly tapping into inflections to pluralize for my native language... it was chaos, irregularity all over the place. ^^
ANeves
I see here (http://www.dutchgrammar.com/en/?n=NounsAndArticles.11) that the -en termination is the regular one. You should be able to code the default rule with .plural and .singular, then follow it by irregular plurals.
Christian Lescuyer
I'd probably try googling to see if anyone has already created an inflections.rb for Dutch. No need for people to get things wrong more than once! :)
Andrew Grimm