I’ve used Rails many years ago and like the idea using singular and plural names. And the scaffold-command performs well in that regard.
But plural in English is often different than in say Norwegian and Danish. As an example I’m writing an application that keeps track of equipment, person assigned to, type etc. Very basic and a good fit for me to become acquainted with RWjs.
The singular Unit becomes Units in English. Unit in Norwegian is Enhet (singular) and Enheter (plural). After I ran the scaffold-command I searched any occurenses of Enhets and changed to Enheter to make it correct.
Would it be possible to add a flag to the scaffold-command to indicate what the plural ending is if it differs from the s-ending?
@kometen this is an important case! Thanks for opening the discussion. The short answer --> yes, it would be possible, but I’m not sure how tedious the implementation would be.
Interesting idea, however I’d voice some doubts about feasibility: some languages have more than one form of plural ( to confirm but I heard that russian would have 4 different types of plural… ). How will we prioritize who gets what?
@mgreenbe Conceptually this would be fantastic. Not sure how well this would play with the current packages we’re using, but if I recall correctly it might be possible.
@rob Looping you in here to see if it generates any ideas.
Also, as a bit of an update, did we ever tell you all about the time Tom was doing a live demo and “Pokemon” blew the whole thing up??
Someone suggested adding custom pluralization rules to redwood.toml which sounded great to me, but I have no idea what goes into reading those in and turning them into function calls on pluralize to set them up:
// Example of new plural rule:
pluralize.plural('regex') //=> "regexes"
pluralize.addPluralRule(/gex$/i, 'gexii')
pluralize.plural('regex') //=> "regexii"
// Example of new singular rule:
pluralize.singular('singles') //=> "single"
pluralize.addSingularRule(/singles$/i, 'singular')
pluralize.singular('singles') //=> "singular"
// Example of new irregular rule, e.g. "I" -> "we":
pluralize.plural('irregular') //=> "irregulars"
pluralize.addIrregularRule('irregular', 'regular')
pluralize.plural('irregular') //=> "regular"
// Example of uncountable rule (rules without singular/plural in context):
pluralize.plural('paper') //=> "papers"
pluralize.addUncountableRule('paper')
pluralize.plural('paper') //=> "paper"
// Example of asking whether a word looks singular or plural:
pluralize.isPlural('test') //=> false
pluralize.isSingular('test') //=> true