public override bool Validate(out string message) { if (IsValid) { message = null; return(true); } IsValid = IcuRulesCollator.ValidateSortRules(CollationRules, out message); return(IsValid); }
private static AddSortKeysToXml.SortKeyGenerator GetSortKeyGeneratorFromArgument(string s) { if (s.StartsWith("icu:", StringComparison.CurrentCultureIgnoreCase)) { IcuRulesCollator collator = new IcuRulesCollator(s.Substring(4)); return(collator.GetSortKey); } if (s.StartsWith("simple:", StringComparison.CurrentCultureIgnoreCase)) { SimpleRulesCollator collator = new SimpleRulesCollator(s.Substring(7)); return(collator.GetSortKey); } return(CultureInfo.GetCultureInfo(s).CompareInfo.GetSortKey); }
private static AddSortKeysToXml.SortKeyGenerator GetSortKeyGeneratorFromArgument(string s) { string icuRules = null; if (s.StartsWith("icu:", StringComparison.CurrentCultureIgnoreCase)) { icuRules = s.Substring(4); } else if (s.StartsWith("simple:", StringComparison.CurrentCultureIgnoreCase)) { var parser = new SimpleRulesParser(); icuRules = parser.ConvertToIcuRules(s.Substring(7)); } if (icuRules != null) { var collator = new IcuRulesCollator(icuRules); return(collator.GetSortKey); } return(CultureInfo.GetCultureInfo(s).CompareInfo.GetSortKey); }