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

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, <optional genitive>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’