Talk:Plural/Mediawiki plural rules



Thread titleRepliesLast modified
ga / Irish / Gaeilge109:36, 20 March 2022
Checking the rules022:53, 4 February 2013

ga / Irish / Gaeilge

Edited by 2 users.
Last edit: 09:36, 20 March 2022

Strictly speaking, this isn't about plurals as such, but forms of words used after numbers.

I'm not sure I completely understand how these rules work or how they're to be implemented. I've a feeling I've explained these in detail to people in the past but nothing's ended up in the software, so maybe this a good place to record how it should work for future reference.

There are two systems for counting things: one is arguably more natural and is used in the living dialects, the other is probably used more in schooling. The first system does not use plurals but initial consonants are mutated. The second system uses plural forms and no mutations, so it's like English.

There is also a system for counting people which affects only 1-10 & 12. In the context of numerals I suppose the noun could just be left out, though that would cause warnings. If a noun is also included then it is only affected by beirt "two".

Zero (nialas) is not a natural counting number. It's much more natural to say "no X" (X ar bith) than "zero X".

Examples using bád "boat".

Mutation System
No. Mutation Example
0 none 0 bád (understandable but not natural)

bád ar bith ("no boat" would be better)

1 lenition + amháin 1 bhád amháin

(in speech bád or bád amháin is maybe more natural)

2-6 [12-16, 21-26, 31-36...] lenition 2 bhád
7-10 [17-19, ...] eclipsis 7 mbád
20 [30 ... 100...1000] none 20 bád

One could be conflated with 2-6, i.e. 1 bhád is understandable, though when spelled out (aon bhád') could mean "any boat" rather than "one boat".

There are also exceptions for measuring nouns with numbers higher than 2. These nouns are either in the plural or a special form and are not mutated.

Plurals System
No. Example
0 0 bád? / 0 báid? / bád ar bith

(nialas báid just sounds demented)

1 1 bhád
everything else 2 báid, 20 báid
Counting people
No. Example With noun
1 duine / duine amháin (it is the noun)
2 beirt (lenition) beirt fhear
3 triúr (no mutation) triúr fear
4 ceathrar (no mutation)
5 cúigear (no mutation)
6 seisear (no mutation)
7 seachtar (no mutation)
8 ochtar (no mutation)
9 naonúr (no mutation)
10 deichniúr (no mutation)
12 dháréag (no mutation)
Category Examples Rules
one 1 one → n is 1;
two 2 two → n is 2;
few 3-6 few → n in 3..6;
many 7-10 many → n in 7..10;
other 0, 11-999;

1.2, 2.07, 3.94, 7.81, 11.68...

other → everything else

This seems to be using System 1 up to 10 then plurals (i.e. System 2) for everything else.

Based on the Mutations System (and ignoring Personal Numbers) I've amended the Irish entry to...

Language Code Group Rules Examples Note
Irish ga has-duala
Broken link!
n is 0
n is 1
2-6, 12-16, 21-26, 31-36...
7-10, 17-19, 27-29...
2-6, 12-16, 21-26, 31-36...
7-10, 17-19, 27-29...
see Talk page for details

I don't know how to represent these mathematically.

I don't know what the broken link is about, but if it's about the dual case, that's pretty much defunct.

Moilleadóir 04:19, 4 February 2013

In summary, compared to CLDR:

  • you've added an "zero" form: no problem it can be specified after the default plural, using an explicit selector "zero=" ("0=" would be different: it would only override "other" for the exact value 0, while "zero=" would also override any other value with the same class as 0; but in the example above, this does not make a difference, except possibly with small non-zero decimal numbers lower than 1 like "0.1" or the numeric value "0.00" with explicit decimals: do they map also to the "zero" class or do they continue to be like "other" plurals?)
  • you're not clear about how you map 11, it seems to be also "other" in your new table (this would still match CDLR).
  • you've dropped form "two", merging it into form "few" for paucal

This means that for a few words we'll need an exception in:

{{PLURAL:$1|one|few|many|other}}, or

by adding an explicit numeric case (because the labelled selector "two" would become unusable):

{{PLURAL:$1|one|2=two|few|many|other}}, or

This also means adding a ruleset to know how to interpret the second form (two or "few) and the followings (when they have no explicit selector)

The alternative is to request to MediaWiki to consider the selector "two" as optional (but it needs to be explicit with a label to override "few", and if it is not specified it will fallback to the value for the selector for "few" if present, other it will then fallback the value given for "other"); just like the selector "zero" would be optional (but it needs to have an explicit selector, otherwise it must fallback only to "other").

In that case the situation is simpler (ruleset no longer needed to handle the rare exceptions for "zero" and "two" as additional overrides):

{{PLURAL:$1|one|few|many|other|two=two}}, or

But then the basic rule order is just reduced to 4 orderable forms (not needing explicit selectors):

{{PLURAL:$1|one|few|many|other}}</nowiki>, so that

here we can still drop unnecessary items, while preserving the standard order:

{{PLURAL:$1|one|few|other}}, or
{{PLURAL:$1|one|other}}</nowiki> or
{{PLURAL:$1|other}}</nowiki> (for invariable cases), or

Or add specific overrides anywhere (except for "other") using explicit (numeric or symbolic) selectors:

{{PLURAL:$1|other|10=ten}}</nowiki>, or
{{PLURAL:$1|other|two=two}}</nowiki> (the cases "one", "few" and "many' will fallback to "other")

But note that alternate rulesets (based only on counting how many forms are specified to "guess" what this means) are deprecated in MediaWiki: this means that the solution using explicit selectors for overrides is preferable, and that a single ruleset with up to 4 forms by default ("one", "few", many", "other" in that order, only the last being preserved and implicit at end of list without needing any explicit "other" selector) is the best solution (and it can significantly help translators by reducing the number of cases to handle).

This means that MediaWiki must know how it fallbacks from a missing form: it is not necessarily a fallback to "other" but to another existing selector: the common selectors "zero", "one", two", "few", "many", "other" form a directed graph (a tree whose nodes are pointing down to the same root which is the "other" node), and that all other selectors (with exact numeric values) are overrides having precedence before matching the standard selectors with their predefined rules and their fallback tree.

Such solution would also be useful for Slavic languages. It could also handle other language-specific selectors such as changes of elision/mutation, numbers with variable grammatical cases, or different usages

You also spoke about counting persons as an exception to the bormal ruleset: how can we specify a "usage" or "context" parameter inside a "PLURAL:" parser call, do we need a "rules=" selector taking specific values whic are not a textual form but a selector for a different ruleset, such as "rules=people" dour counting persons, or "rules=math" for maths, or "rules=sci" in sciences like units of measurements, or "rules=honor" for honorfic variants, or "rules=incl/excl" for or not counting ourself inclusively, or "rules=frac" for fractions, or "rules=mil" in French for the alternate form for thousands used in ordinal years in calendar dates ?

Verdy p (talk)04:41, 18 March 2022

Checking the rules

The entries on the table of mediawiki plural rules have been checked by translators to ensure the rules are accurately recorded in the table, for the following languages: Be, Cs, Cy, Ksh, Pl.

Lloffiwr (talk)12:51, 30 May 2012