You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes it need more documentation but in short : you can split a translation with | and specify an integer model to choose the translation to use. The translation can be split in 2 or in 3 depending if you want a specific text when the model is 0. you can also use {model} to inject the value in the text.
Example.loc.json
{
"PluralizedTextIdWithZero": {
"en": "No element found | One element found | {model} elements found",
"...":"..."
},
"PluralizedTextId": {
"en": "element | elements",
"...":"..."
}
}
In C#
Loc.Tr("PluralizedTextIdWithZero",0);// --> No element foundLoc.Tr("PluralizedTextIdWithZero",1);// --> One element foundLoc.Tr("PluralizedTextIdWithZero",2);// --> 2 elements foundLoc.Tr("PluralizedTextIdWithZero",10);// --> 10 elements foundLoc.Tr("PluralizedTextId",0);// --> elementLoc.Tr("PluralizedTextId",1);// --> elementLoc.Tr("PluralizedTextId",2);// --> elementsLoc.Tr("PluralizedTextId",10);// -->elements
In XAML
<!-- With static model -->
<TextBlockText="{Tr PluralizedTextIdWithZero, Model=1}" />
<!-- With dynamic bindable model (DataContext) -->
<TextBlockText="{Tr PluralizedTextIdWithZero, ModelBinding={Binding MyObservableCollection.Count}}" />
There isn't an example of a plural translation using the Tr and bindings. How can I do this?
The text was updated successfully, but these errors were encountered: