Пример #1
0
		private SimpleRulesCollationDefinition ReadCollationRulesForCustomSimple(XElement collationElem, XElement specialElem, string collationType)
		{
			XElement simpleElem = specialElem.Element(Sil + "simple");
			bool needsCompiling = (bool?) specialElem.Attribute(Sil + "needscompiling") ?? false;
			var scd = new SimpleRulesCollationDefinition(collationType) {SimpleRules = ((string) simpleElem).Replace("\n", "\r\n")};
			if (!needsCompiling)
			{
				scd.CollationRules = LdmlCollationParser.GetIcuRulesFromCollationNode(collationElem);
				scd.IsValid = true;
			}
			return scd;
		}
Пример #2
0
		private void WriteCollationRulesFromCustomSimple(XElement collationElem, SimpleRulesCollationDefinition scd)
		{
			// If collation valid and icu rules exist, populate icu rules
			if (!string.IsNullOrEmpty(scd.CollationRules))
				collationElem.Add(new XElement("cr", new XCData(scd.CollationRules)));

			XElement specialElem = GetOrCreateSpecialElement(collationElem);
			// SLDR generally doesn't include needsCompiling if false
			specialElem.SetAttributeValue(Sil + "needsCompiling", scd.IsValid ? null : "true");
			specialElem.Add(new XElement(Sil + "simple", new XCData(scd.SimpleRules)));
		}