How to represent plural rules for Russian or other complex plural languages in ICU MessageFormat
Asked Answered
P

1

6

How can we represent Russian in ICU MessageFormat given the unusual nature of the pluralization rules?

MessageFormat supports pluralization like {arg, plural, =1 {one} other {other}} and more complex {arg, plural, =0 {none} =1 {one} =2 {few} other {several}}.

However, sometimes the text to use cannot be directly determined by the number without some calculations; how do we do that? Russian has three plural rules based on the last digit in the number with exceptions for 11-14.

Info I've reviewed:

Russian language pluralization

http://www.russianlessons.net/lessons/lesson11_main.php

MessageFormat Rules

http://userguide.icu-project.org/formatparse/messages

Number of plural rules for various languages

https://developer.mozilla.org/en-US/docs/Mozilla/Localization/Localization_and_Plurals

Passionless answered 20/6, 2020 at 14:46 Comment(0)
P
6

Russian ICU pluralization example for apples (яблоко).

{arg, plural, =0 {нет яблок} one {одно яблоко} few {{arg} яблока} other {{arg} яблок}}

one works for numbers ending with 1, except 11

few works for numbers ending with 2, 3, 4, again, except 12, 13 and 14

other is just "many" form

Pulpiteer answered 15/12, 2020 at 17:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.