/// <summary> /// Initializes a new instance of the <see cref="Catalog"/> class that has no translations /// using given culture info and plural rule generated by DefaultPluralRuleGenerator for given culture. /// </summary> /// <param name="cultureInfo">Culture info.</param> public Catalog(CultureInfo cultureInfo) { this.CultureInfo = cultureInfo; this.FormatProvider = cultureInfo; this.Translations = new Dictionary <string, string[]>(); this.PluralRule = (new DefaultPluralRuleGenerator()).CreateRule(cultureInfo); }
/// <summary> /// </summary> /// <param name="filterCriteria"></param> /// <returns></returns> public virtual IPluralRulesEnumerable Query(PluralRuleInfo filterCriteria) { if (filterCriteria.Equals(PluralRuleInfo.Empty)) { return(this); } int c = 0; foreach (var rule in this) { if (filterCriteria.FilterMatch(rule.Info)) { c++; } } IPluralRule[] result = new IPluralRule[c]; int i = 0; foreach (var rule in this) { if (filterCriteria.FilterMatch(rule.Info)) { result[i++] = rule; } } return(new PluralRulesArray(result)); }
public GettextPluralBuilder(IPluralRule pluralRule) { _pluralRule = pluralRule; }
/// <summary> /// Initializes a new instance of the <see cref="BaseCatalog"/> class that has no translations /// using given culture info and given plural rule. /// </summary> /// <param name="cultureInfo"></param> /// <param name="pluralRule"></param> protected BaseCatalog(CultureInfo cultureInfo, IPluralRule pluralRule) { this.Translations = new Dictionary<string, string[]>(); this.CultureInfo = cultureInfo; this.PluralRule = pluralRule; }