Beispiel #1
0
        public void MultiIcu()
        {
            const string MULTI = "{name, gender, male {{0} will bring his} female {{0} will bring her}} {cars, plural, one {car} other {{0} cars}}.";

            Language.Id = "en";

            Same(
                MultiPattern.FormatMulti(
                    MULTI,
                    new
            {
                Gender = Gender.Male,
                Value  = "John"
            },
                    2),
                "John will bring his 2 cars.");

            Same(
                MultiPattern.FormatMulti(
                    MULTI,
                    new { Gender = Gender.Male, Value = "Bill" },
                    1),
                "Bill will bring his car.");

            Same(
                MultiPattern.FormatMulti(
                    MULTI,
                    new { Gender = Gender.Female, Value = "Jill" },
                    3),
                "Jill will bring her 3 cars.");

            Same(
                MultiPattern.FormatMulti(
                    MULTI,
                    new
            {
                Gender = Gender.Female,
                Value  = "Alma"
            },
                    1),
                "Alma will bring her car.");
        }
Beispiel #2
0
 public string GetPlayers(Sport sport)
 {
     return(MultiPattern.FormatMulti(localizer["{plural, one {{0} player} other {{0} players}}"], sport.Players)); //loc 0: Number of players
 }
Beispiel #3
0
 private void ProcessMultiPlural(uint completed, int total, Label label)
 {
     label.Text      = MultiPattern.FormatMulti(Properties.Resources.MessagePlural, completed, total);
     label.ForeColor = Color.Green;
 }