예제 #1
0
        /// <summary>
        /// Gets rules for a combination of name type, rule type and a single language.
        /// <para/>
        /// since 1.9
        /// </summary>
        /// <param name="nameType">The <see cref="NameType"/> to consider.</param>
        /// <param name="rt">The <see cref="RuleType"/> to consider.</param>
        /// <param name="lang">The language to consider.</param>
        /// <returns>A map containing all <see cref="Rule"/>s that apply, grouped by the first character of the rule pattern.</returns>
        public static IDictionary <string, IList <Rule> > GetInstanceMap(NameType nameType, RuleType rt,
                                                                         string lang)
        {
            if (RULES.TryGetValue(nameType, out var nameTypes) && nameTypes != null &&
                nameTypes.TryGetValue(rt, out var ruleTypes) && ruleTypes != null &&
                ruleTypes.TryGetValue(lang, out var rules) && rules != null)
            {
            }
            else
            {
                throw new ArgumentException(string.Format("No rules found for {0}, {1}, {2}.",
                                                          nameType.GetName(), rt.GetName(), lang));
            }

            return(rules);
        }
예제 #2
0
 private static string LangResourceName(NameType nameType)
 {
     return(string.Format("{0}_languages.txt", nameType.GetName()));
 }
예제 #3
0
 private static string CreateResourceName(NameType nameType, RuleType rt, string lang)
 {
     return(string.Format("{0}_{1}_{2}.txt",
                          nameType.GetName(), rt.GetName(), lang));
 }