# Add variable argument length second argument to ActiveSupport pluralize(?)

**URL:** <https://www.ruby-forum.com/t/add-variable-argument-length-second-argument-to-activesupport-pluralize/237978>\
**Category:** Rails\
**Created:** [December 9, 2013, 10:18pm UTC](https://www.ruby-forum.com/t/add-variable-argument-length-second-argument-to-activesupport-pluralize/237978 "2013-12-09T22:18:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [December 9, 2013, 10:18pm UTC](https://www.ruby-forum.com/t/add-variable-argument-length-second-argument-to-activesupport-pluralize/237978/1 "2013-12-09T22:18:01Z")

</div>

In most languages that I know (English, Dutch), the plural case can be  
derived from the singular – modulo a few irregularities e.g. boy/boys,  
sheep/sheep, straat/straten, auto/auto’s, etc.

In a great many other languages, however, it is not possible to know the  
plural without some additional datum e.g. the genitive singular form.

As implemented, the arity of `pluralize` is strictly one. If it were to  
permit variable arguments _after_ that single required argument an  
enterprising soul might alter the behavior of  
pluralize to take those additional data into consideration when  
performing  
the pluralization. What would the feeling be about changing this  
behavior?  
While the applicability of Latin to modern development is dubious, the  
fact that there are languages whose plurals can’t be derived from the  
nominative has wider applicability. If this idea were deemed to be too  
niche merely altering the method’s interface would allow something like  
ActiveSupport::CasedLanguage.pluralize(singular, \*args) to implement  
these  
features for those who desire it.

Let me give more specifics:

in Latin, for example, there are ambiguities around some endings,  
particularly a noun ending in ‘us’. Consider ‘dominus’ and ‘currus’.  
Simply  
matching a RegEx on /us$/ would give us dominus -\> domini (right) but  
also  
currus -\> curri (wrong).

Latin students memorize dominus as: ‘dominus, domini (singular  
genitive),  
masculine’ and currus as ‘currus, currūs, masculine’. This is how  
students  
disambiguate the two.

So, now, how to handle that in ActiveSupport?

Well, hmph.

It seems like we should be able to say:

‘currus’.pluralize(:la) #=\> ‘currūs’  
dominus’.pluralize(:la) #=\> ‘domini’

But this produces the wrong results, as mentioned above. If pluralize  
took  
a second argument of an array we might be able to do something  
like:

‘currus’.pluralize(:la, currūs) #=\> ‘currūs’

then:

dominus’.pluralize(:la) #=\> ‘domini’ - WORKS  
‘currus’.pluralize(:la, ‘currūs’) #=\> ‘currūs’ - WORKS

This design would also allow me to support the 3rd declension of Latin  
verbs which are identified _by the genitive_ not _by the nominative_.

A list of rules based on the nominative ending will fail to catch this  
one

arx’.pluralize(:la) #=\> wtf?

whereas

‘arx’.pluralize(:la, ‘arcis’) #=\> ‘arces’ - WORKS

It _also_ might allow a gateway to something like

‘arx’.pluralize(:la, ‘arcis’, :ablative) # =\> ‘arcibus’
