コード例 #1
0
ファイル: TimeTextInfo.cs プロジェクト: axunonb/SmartFormat
        private static string GetValue(PluralRules.PluralRuleDelegate pluralRule, int value, IReadOnlyList <string> units)
        {
            // Get the plural index from the plural rule,
            // unless there's only 1 unit in the first place:
            var pluralIndex = units.Count == 1 ? 0 : pluralRule(value, units.Count);

            return(string.Format(units[pluralIndex], value));
        }
コード例 #2
0
        private static string getValue(PluralRules.PluralRuleDelegate pluralRule, int value, string[] units)
        {
            // Get the plural index from the plural rule,
            // unless there's only 1 unit in the first place:
            var pluralIndex = units.Length == 1 ? 0 : pluralRule(value, units.Length);

            return(string.Format(units[pluralIndex], value));
        }
コード例 #3
0
 public TimeTextInfo(string week, string day, string hour, string minute, string second, string millisecond, string lessThan)
 {
     // Always use singular:
     this.PluralRule  = (d, c) => 0;
     this.week        = new[] { week };
     this.day         = new[] { day };
     this.hour        = new[] { hour };
     this.minute      = new[] { minute };
     this.second      = new[] { second };
     this.millisecond = new[] { millisecond };
     this.lessThan    = lessThan;
 }
コード例 #4
0
        public TimeTextInfo(string week, string day, string hour, string minute, string second, string millisecond,
                            string lessThan)
        {
            // must not be null here
            d = h = m = ms = s = w = new string[] {};

            // Always use singular:
            PluralRule       = (d, c) => 0;
            this.week        = new[] { week };
            this.day         = new[] { day };
            this.hour        = new[] { hour };
            this.minute      = new[] { minute };
            this.second      = new[] { second };
            this.millisecond = new[] { millisecond };
            this.lessThan    = lessThan;
        }
コード例 #5
0
        public TimeTextInfo(PluralRules.PluralRuleDelegate pluralRule, string[] week, string[] day, string[] hour, string[] minute, string[] second, string[] millisecond, string[] w, string[] d, string[] h, string[] m, string[] s, string[] ms, string lessThan)
        {
            this.PluralRule = pluralRule;

            this.week        = week;
            this.day         = day;
            this.hour        = hour;
            this.minute      = minute;
            this.second      = second;
            this.millisecond = millisecond;

            this.w  = w;
            this.d  = d;
            this.h  = h;
            this.m  = m;
            this.s  = s;
            this.ms = ms;

            this.lessThan = lessThan;
        }
コード例 #6
0
 public CustomPluralRuleProvider(PluralRules.PluralRuleDelegate pluralRule)
 {
     _pluralRule = pluralRule;
 }
コード例 #7
0
		public CustomPluralRuleProvider(PluralRules.PluralRuleDelegate pluralRule)
		{
			this.pluralRule = pluralRule;
		}
コード例 #8
0
		public TimeTextInfo(string week, string day, string hour, string minute, string second, string millisecond, string lessThan)
		{
			// Always use singular:
			this.PluralRule = (d, c) => 0;
			this.week = new[] { week };
			this.day = new[] { day };
			this.hour = new[] { hour };
			this.minute = new[] { minute };
			this.second = new[] { second };
			this.millisecond = new[] { millisecond };
			this.lessThan = lessThan;
		}
コード例 #9
0
		public TimeTextInfo(PluralRules.PluralRuleDelegate pluralRule, string[] week, string[] day, string[] hour, string[] minute, string[] second, string[] millisecond, string[] w, string[] d, string[] h, string[] m, string[] s, string[] ms, string lessThan)
		{
			this.PluralRule = pluralRule;

			this.week = week;
			this.day = day;
			this.hour = hour;
			this.minute = minute;
			this.second = second;
			this.millisecond = millisecond;

			this.w = w;
			this.d = d;
			this.h = h;
			this.m = m;
			this.s = s;
			this.ms = ms;

			this.lessThan = lessThan;
		}