Pluralization
Localization texts can be pluralized for inflections of numeric parameters.
To use Unicode CLDR rules, add package reference.
<PropertyGroup>
<RestoreAdditionalProjectSources>https://avalanche.fi/Avalanche.Core/nupkg/index.json</RestoreAdditionalProjectSources>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Avalanche.Localization.Cldr"/>
</ItemGroup>
Plurals "parameterName:category:case[:culture]" argument indicates which rule, category and case a Text uses.
PluralRules "ruleset" must be placed to indicate which rule version is used. Plural rules are listed here.
TemplateFormat: BraceNumeric
PluralRules: Unicode.CLDR41
English:
- Culture: en
Items:
- Key: Namespace.Apples
Cases:
- Text: "You've got an apple."
Plurals: "0:cardinal:one"
- Text: "You've got {0} apples."
Plurals: "0:cardinal:other"
Finnish:
- Culture: fi
Items:
- Key: Namespace.Apples
Cases:
- Text: "Sinulla on yksi omena."
Plurals: "0:cardinal:one"
- Text: "Sinulla on {0} omenaa."
Plurals: "0:cardinal:other"
There are two plurality categories: "cardinal" and "ordinal". Ordinal is category for order numbers, e.g. 1st, 2nd, 3rd. English rules have the following 'ordinal' cases: one for first, two for second, few for third, and other for higher ordinals.
# Configuration
TemplateFormat: BraceNumeric
PluralRules: Unicode.CLDR41
English:
- Culture: en
Items:
- Key: Namespace.ExitRoundabout
Cases:
- Text: "Take first exit."
Plurals: "0:ordinal:one"
- Text: "Take second exit."
Plurals: "0:ordinal:two"
- Text: "Take third exit."
Plurals: "0:ordinal:few"
- Text: "Take {0}th exit."
Plurals: "0:ordinal:other"
Finnish:
- Culture: fi
Items:
- Key: Namespace.ExitRoundabout
Text: "Poistu {0}. erkanemiskaistalta."
Plurals: "0:ordinal:other"