-
Notifications
You must be signed in to change notification settings - Fork 12
Features: Variants
Rudy Huyn edited this page Aug 1, 2019
·
3 revisions
It is sometimes necessary to include several variants of the same character string in your application to support different personal pronouns: (for example: Send him/her a gift). To support this type of scenario, you usually must write code in your ViewModel or use IValueConverter to select the correct text you want to use. ReswPlus can simplify this task and fully manage the support of string variants for you, a unique resource identifier would return different strings according to your needs.
Variants can not only be used to represent genders/personal pronouns but also for groups, categories...
Resw:
Key | Value |
---|---|
SendAMessage_Variant1 | Send her a message |
SendAMessage_Variant2 | Send him a message |
SendAMessage_Variant3 | Send them a message |
SendAMessage_Variant4 | Send zir a message |
Usage:
enum PersonalPronoun{ HER = 1, HIM, THEM, ZIR };
class Person
{
public PersonalPronoun PronounId{get;set;}
}
Resources.SendAMessage(Person.PronounId);
Display a welcome message depending of the current time:
Resw:
Key | Value |
---|---|
Greeting_Variant0 | Good morning, enjoy your day |
Greeting_Variant1 | Good afternoon, have a good time |
Greeting_Variant2 | Good evening, hope your day was fine |
Greeting_Variant4 | Good night, sleep well, see you tomorrow |
Usage:
enum PartOfTheDayEnum { MORNING = 0, AFTERNOON = 1, EVENING = 2, NIGHT = 4 };
Resources.Greeting(PartOfTheDay);