public inform ( ResourceLoader loader ) : void | ||
loader | ResourceLoader | |
return | void |
/* * For german, you might want oe to sort and match with o umlaut. * This is not the default, but you can make a customized ruleset to do this. * * The default is DIN 5007-1, this shows how to tailor a collator to get DIN 5007-2 behavior. * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4423383 */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testCustomRules() throws Exception public virtual void testCustomRules() { RuleBasedCollator baseCollator = (RuleBasedCollator)Collator.getInstance(new Locale("de", "DE")); string DIN5007_2_tailorings = "& ae , a\u0308 & AE , A\u0308" + "& oe , o\u0308 & OE , O\u0308" + "& ue , u\u0308 & UE , u\u0308"; RuleBasedCollator tailoredCollator = new RuleBasedCollator(baseCollator.Rules + DIN5007_2_tailorings); string tailoredRules = tailoredCollator.Rules; // // at this point, you would save these tailoredRules to a file, // and use the custom parameter. // string germanUmlaut = "Töne"; string germanOE = "Toene"; IDictionary <string, string> args = new Dictionary <string, string>(); args["custom"] = "rules.txt"; args["strength"] = "primary"; CollationKeyFilterFactory factory = new CollationKeyFilterFactory(args); factory.inform(new StringMockResourceLoader(tailoredRules)); TokenStream tsUmlaut = factory.create(new MockTokenizer(new StringReader(germanUmlaut), MockTokenizer.KEYWORD, false)); TokenStream tsOE = factory.create(new MockTokenizer(new StringReader(germanOE), MockTokenizer.KEYWORD, false)); assertCollatesToSame(tsUmlaut, tsOE); }
/* * For german, you might want oe to sort and match with o umlaut. * This is not the default, but you can make a customized ruleset to do this. * * The default is DIN 5007-1, this shows how to tailor a collator to get DIN 5007-2 behavior. * http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4423383 */ //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testCustomRules() throws Exception public virtual void testCustomRules() { RuleBasedCollator baseCollator = (RuleBasedCollator) Collator.getInstance(new Locale("de", "DE")); string DIN5007_2_tailorings = "& ae , a\u0308 & AE , A\u0308" + "& oe , o\u0308 & OE , O\u0308" + "& ue , u\u0308 & UE , u\u0308"; RuleBasedCollator tailoredCollator = new RuleBasedCollator(baseCollator.Rules + DIN5007_2_tailorings); string tailoredRules = tailoredCollator.Rules; // // at this point, you would save these tailoredRules to a file, // and use the custom parameter. // string germanUmlaut = "Töne"; string germanOE = "Toene"; IDictionary<string, string> args = new Dictionary<string, string>(); args["custom"] = "rules.txt"; args["strength"] = "primary"; CollationKeyFilterFactory factory = new CollationKeyFilterFactory(args); factory.inform(new StringMockResourceLoader(tailoredRules)); TokenStream tsUmlaut = factory.create(new MockTokenizer(new StringReader(germanUmlaut), MockTokenizer.KEYWORD, false)); TokenStream tsOE = factory.create(new MockTokenizer(new StringReader(germanOE), MockTokenizer.KEYWORD, false)); assertCollatesToSame(tsUmlaut, tsOE); }