ruby-i18n/ruby-cldr

[CLDR v38+] Support / handle unit inflections

Opened this issue · 0 comments

This PR added inflections to units, so entries in the data changed from:

<unit type="duration-day">
  <displayName>Tage</displayName>
  <unitPattern count="one">{0} Tag</unitPattern>
  <unitPattern count="other">{0} Tage</unitPattern>
  <perUnitPattern>{0} pro Tag</perUnitPattern>
</unit>

to

<unit type="duration-day">
  <gender>masculine</gender>
  <displayName>Tage</displayName>
  <unitPattern count="one">{0} Tag</unitPattern>
  <unitPattern count="one" case="accusative">{0} Tag</unitPattern>
  <unitPattern count="one" case="dative">{0} Tag</unitPattern>
  <unitPattern count="one" case="genitive">{0} Tages</unitPattern>
  <unitPattern count="other">{0} Tage</unitPattern>
  <unitPattern count="other" case="accusative">{0} Tage</unitPattern>
  <unitPattern count="other" case="dative">{0} Tagen</unitPattern>
  <unitPattern count="other" case="genitive">{0} Tage</unitPattern>
  <perUnitPattern>{0} pro Tag</perUnitPattern>
</unit>

Notably, there are now multiple values for each of the count attributes (one for each case). Previously, there was only the "nominative" case.

Using ruby-cldr with v38 gives a different behaviour than it did with v37, since this code returns whatever case happens to appear last in the file (in this case "genitive" in v38, "accusative" in v37).


As a first step, we should change the code to return the "nominative" case.
Longer term, we can look into ways to expose the other cases.