private static string ToTitleWholeStringNoLowercase(ULocale locale, string s) { return(TO_TITLE_WHOLE_STRING_NO_LOWERCASE.Apply( locale.ToLocale(), null, s, new StringBuilder(), null).ToString()); }
public override String GetDisplayName(String idForDisplay, ULocale locale) { return((visible && idForDisplay.Equals(this.id)) ? "(" + locale.ToString() + ") " + idForDisplay : null); }
public static IDictionary GetDisplayNames(ULocale locale) { return(GetDisplayNames(Registry(), locale)); }
public override string LocaleDisplayName(ULocale locale) { return(locale.GetName()); }
public void TestThaiDictionaryBreakIterator() { int position; int index; int[] result = { 1, 2, 5, 10, 11, 12, 11, 10, 5, 2, 1, 0 }; char[] ctext = { (char)0x0041, (char)0x0020, (char)0x0E01, (char)0x0E32,(char)0x0E23, (char)0x0E17, (char)0x0E14, (char)0x0E25, (char)0x0E2D, (char)0x0E07, (char)0x0020, (char)0x0041 }; String text = new String(ctext); ULocale locale = ULocale.CreateCanonical("th"); BreakIterator b = BreakIterator.GetWordInstance(locale); b.SetText(text); index = 0; // Test forward iteration while ((position = b.Next()) != BreakIterator.Done) { if (position != result[index++]) { Errln("Error with ThaiDictionaryBreakIterator forward iteration test at " + position + ".\nShould have been " + result[index - 1]); } } // Test backward iteration while ((position = b.Previous()) != BreakIterator.Done) { if (position != result[index++]) { Errln("Error with ThaiDictionaryBreakIterator backward iteration test at " + position + ".\nShould have been " + result[index - 1]); } } //Test invalid sequence and spaces char[] text2 = { (char)0x0E01, (char)0x0E39, (char)0x0020, (char)0x0E01, (char)0x0E34, (char)0x0E19, (char)0x0E01, (char)0x0E38, (char)0x0E49, (char)0x0E07, (char)0x0020, (char)0x0E1B, (char)0x0E34, (char)0x0E49, (char)0x0E48, (char)0x0E07, (char)0x0E2D, (char)0x0E22, (char)0x0E39, (char)0x0E48, (char)0x0E43, (char)0x0E19, (char)0x0E16, (char)0x0E49, (char)0x0E33 }; int[] expectedWordResult = { 2, 3, 6, 10, 11, 15, 17, 20, 22 }; int[] expectedLineResult = { 3, 6, 11, 15, 17, 20, 22 }; BreakIterator brk = BreakIterator.GetWordInstance(new ULocale("th")); brk.SetText(new String(text2)); position = index = 0; while ((position = brk.Next()) != BreakIterator.Done && position < text2.Length) { if (position != expectedWordResult[index++]) { Errln("Incorrect break given by thai word break iterator. Expected: " + expectedWordResult[index - 1] + " Got: " + position); } } brk = BreakIterator.GetLineInstance(new ULocale("th")); brk.SetText(new String(text2)); position = index = 0; while ((position = brk.Next()) != BreakIterator.Done && position < text2.Length) { if (position != expectedLineResult[index++]) { Errln("Incorrect break given by thai line break iterator. Expected: " + expectedLineResult[index - 1] + " Got: " + position); } } // Improve code coverage if (brk.Preceding(expectedLineResult[1]) != expectedLineResult[0]) { Errln("Incorrect preceding position."); } if (brk.Following(expectedLineResult[1]) != expectedLineResult[2]) { Errln("Incorrect following position."); } int[] fillInArray = new int[2]; if (((RuleBasedBreakIterator)brk).GetRuleStatusVec(fillInArray) != 1 || fillInArray[0] != 0) { Errln("Error: Since getRuleStatusVec is not supported in DictionaryBasedBreakIterator, it should return 1 and fillInArray[0] == 0."); } }
// ICU4N specific - de-nested DialectHandling // factory methods /// <summary> /// Convenience overload of <see cref="GetInstance(ULocale, DialectHandling)"/> that specifies /// <see cref="DialectHandling.StandardNames"/> dialect handling. /// </summary> /// <param name="locale">The display locale.</param> /// <returns>A <see cref="LocaleDisplayNames"/> instance.</returns> /// <stable>ICU 4.4</stable> public static LocaleDisplayNames GetInstance(ULocale locale) { return(GetInstance(locale, DialectHandling.StandardNames)); }
/// <summary> /// Returns an instance of <see cref="LocaleDisplayNames"/> that returns names formatted for the provided /// <see cref="CultureInfo"/>, using the provided <see cref="DisplayContext"/> settings. /// </summary> /// <param name="locale">The display <see cref="CultureInfo"/>.</param> /// <param name="contexts">One or more context settings (e.g. for dialect handling, capitalization, etc.)</param> /// <returns>A <see cref="LocaleDisplayNames"/> instance.</returns> /// <stable>ICU 54</stable> public static LocaleDisplayNames GetInstance(CultureInfo locale, params DisplayContext[] contexts) { return(GetInstance(ULocale.ForLocale(locale), contexts)); }
public LocaleDisplayNames Get(ULocale locale, params DisplayContext[] contexts) { DialectHandling dialectHandlingIn = DialectHandling.StandardNames; DisplayContext capitalizationIn = DisplayContext.CapitalizationNone; DisplayContext nameLengthIn = DisplayContext.LengthFull; DisplayContext substituteHandling = DisplayContext.Substitute; foreach (DisplayContext contextItem in contexts) { switch (contextItem.Type()) { case DisplayContextType.DialectHandling: dialectHandlingIn = (contextItem.Value() == DisplayContext.StandardNames.Value()) ? DialectHandling.StandardNames : DialectHandling.DialectNames; break; case DisplayContextType.Capitalization: capitalizationIn = contextItem; break; case DisplayContextType.DisplayLength: nameLengthIn = contextItem; break; case DisplayContextType.SubstituteHandling: substituteHandling = contextItem; break; default: break; } } syncLock.EnterUpgradeableReadLock(); try { if (!(dialectHandlingIn == this.dialectHandling && capitalizationIn == this.capitalization && nameLengthIn == this.nameLength && substituteHandling == this.substituteHandling && locale.Equals(this.locale))) { syncLock.EnterWriteLock(); try { if (!(dialectHandlingIn == this.dialectHandling && capitalizationIn == this.capitalization && nameLengthIn == this.nameLength && substituteHandling == this.substituteHandling && locale.Equals(this.locale))) { this.locale = locale; this.dialectHandling = dialectHandlingIn; this.capitalization = capitalizationIn; this.nameLength = nameLengthIn; this.substituteHandling = substituteHandling; this.cache = new LocaleDisplayNamesImpl(locale, contexts); } } finally { syncLock.ExitWriteLock(); } } return(cache); } finally { syncLock.ExitUpgradeableReadLock(); } }
internal IDictionary <object, object> displayNames; // locale -> string internal CollatorInfo(ULocale locale, Collator collator, IDictionary <object, object> displayNames) { this.locale = locale; this.collator = collator; this.displayNames = displayNames; }
new public static LocaleDisplayNames GetInstance(ULocale locale, DialectHandling dialectHandling) { // ICU4N: Switched to using ReaderWriterLockSlim instead of lock (cache) return(cache.Get(locale, dialectHandling)); }
new public static LocaleDisplayNames GetInstance(ULocale locale, params DisplayContext[] contexts) { // ICU4N: Switched to using ReaderWriterLockSlim instead of lock (cache) return(cache.Get(locale, contexts)); }
public override DataTable Get(ULocale locale, bool nullIfNotFound) { return(new ICUDataTable(path, locale, nullIfNotFound)); }
public abstract DataTable Get(ULocale locale, bool nullIfNotFound);
public override DataTable Get(ULocale locale, bool nullIfNotFound) { return(new DataTable(nullIfNotFound)); }
public void TestExemplarSet() { HashedSet testedExemplars = new HashedSet(); int equalCount = 0; for (int i = 0; i < availableLocales.Length; i++) { ULocale locale = availableLocales[i]; int[] scriptCodes = IBM.ICU.Lang.UScript.GetCode(locale); if (scriptCodes == null) { // I hate the JDK's solution for deprecated language codes. // Why does the Locale constructor change the string I passed to // it ? // such a broken hack !!!!! // so in effect I can never test the script code for Indonesian // :( if (locale.ToString().IndexOf(("in")) < 0) { Errln("UScript.getCode returned null for locale: " + locale); } continue; } UnicodeSet[] exemplarSets = new UnicodeSet[2]; for (int k = 0; k < 2; ++k) { // for casing option in (normal, // caseInsensitive) int option = (k == 0) ? 0 : IBM.ICU.Text.UnicodeSet.CASE; UnicodeSet exemplarSet = IBM.ICU.Util.LocaleData.GetExemplarSet(locale, option); exemplarSets[k] = exemplarSet; LocaleDataTest.ExemplarGroup exGrp = new LocaleDataTest.ExemplarGroup(exemplarSet, scriptCodes); if (!ILOG.J2CsMapping.Collections.Collections.Contains(exGrp, testedExemplars)) { ILOG.J2CsMapping.Collections.Generics.Collections.Add(testedExemplars, exGrp); UnicodeSet[] sets = new UnicodeSet[scriptCodes.Length]; // create the UnicodeSets for the script for (int j = 0; j < scriptCodes.Length; j++) { sets[j] = new UnicodeSet("[:" + IBM.ICU.Lang.UScript.GetShortName(scriptCodes[j]) + ":]"); } bool existsInScript = false; UnicodeSetIterator iter = new UnicodeSetIterator( exemplarSet); // iterate over the while (!existsInScript && iter.NextRange()) { if (iter.codepoint != IBM.ICU.Text.UnicodeSetIterator.IS_STRING) { for (int j_0 = 0; j_0 < sets.Length; j_0++) { if (sets[j_0].Contains(iter.codepoint, iter.codepointEnd)) { existsInScript = true; break; } } } else { for (int j_1 = 0; j_1 < sets.Length; j_1++) { if (sets[j_1].Contains(iter.str0)) { existsInScript = true; break; } } } } if (existsInScript == false) { Errln("ExemplarSet containment failed for locale : " + locale); } } } // This is expensive, so only do it if it will be visible if (IsVerbose()) { Logln(locale.ToString() + " exemplar " + exemplarSets[0]); Logln(locale.ToString() + " exemplar(case-folded) " + exemplarSets[1]); } AssertTrue(locale.ToString() + " case-folded is a superset", exemplarSets[1].ContainsAll(exemplarSets[0])); if (exemplarSets[1].Equals(exemplarSets[0])) { ++equalCount; } } // Note: The case-folded set should sometimes be a strict superset // and sometimes be equal. AssertTrue( "case-folded is sometimes a strict superset, and sometimes equal", equalCount > 0 && equalCount < availableLocales.Length); }
public void TestRegister() { // register a singleton Collator frcol = Collator.GetInstance(ULocale.FRANCE); Collator uscol = Collator.GetInstance(ULocale.US); { // try override en_US collator Object key = Collator.RegisterInstance(frcol, ULocale.US); Collator ncol = Collator.GetInstance(ULocale.US); if (!frcol.Equals(ncol)) { Errln("register of french collator for en_US failed"); } // coverage Collator test = Collator.GetInstance(ULocale.GERMANY); // CollatorFactory.handleCreate if (!test.GetLocale(ULocale.VALID_LOCALE).Equals(ULocale.GERMAN)) { Errln("Collation from Germany is really " + test.GetLocale(ULocale.VALID_LOCALE)); } if (!Collator.Unregister(key)) { Errln("failed to unregister french collator"); } ncol = Collator.GetInstance(ULocale.US); if (!uscol.Equals(ncol)) { Errln("collator after unregister does not match original"); } } ULocale fu_FU = new ULocale("fu_FU_FOO"); { // try create collator for new locale Collator fucol = Collator.GetInstance(fu_FU); Object key = Collator.RegisterInstance(frcol, fu_FU); Collator ncol = Collator.GetInstance(fu_FU); if (!frcol.Equals(ncol)) { Errln("register of fr collator for fu_FU failed"); } ULocale[] locales = Collator.GetAvailableULocales(); bool found = false; for (int i = 0; i < locales.Length; ++i) { if (locales[i].Equals(fu_FU)) { found = true; break; } } if (!found) { Errln("new locale fu_FU not reported as supported locale"); } try { String name = Collator.GetDisplayName(fu_FU); if (!"fu (FU, FOO)".Equals(name) && !"fu_FU_FOO".Equals(name) /* no LocaleDisplayNamesImpl */) { Errln("found " + name + " for fu_FU"); } } catch (MissingManifestResourceException ex) { Warnln("Could not load locale data."); } try { String name = Collator.GetDisplayName(fu_FU, fu_FU); if (!"fu (FU, FOO)".Equals(name) && !"fu_FU_FOO".Equals(name) /* no LocaleDisplayNamesImpl */) { Errln("found " + name + " for fu_FU"); } } catch (MissingManifestResourceException ex) { Warnln("Could not load locale data."); } if (!Collator.Unregister(key)) { Errln("failed to unregister french collator"); } ncol = Collator.GetInstance(fu_FU); if (!fucol.Equals(ncol)) { Errln("collator after unregister does not match original fu_FU"); } } { // coverage after return to default ULocale[] locales = Collator.GetAvailableULocales(); for (int i = 0; i < locales.Length; ++i) { if (locales[i].Equals(fu_FU)) { Errln("new locale fu_FU not reported as supported locale"); break; } } Collator ncol = Collator.GetInstance(ULocale.US); if (!ncol.GetLocale(ULocale.VALID_LOCALE).Equals(ULocale.US)) { Errln("Collation from US is really " + ncol.GetLocale(ULocale.VALID_LOCALE)); } } }
public void TestExemplarSet2() { int equalCount = 0; HashedSet testedExemplars = new HashedSet(); for (int i = 0; i < availableLocales.Length; i++) { ULocale locale = availableLocales[i]; LocaleData ld = IBM.ICU.Util.LocaleData.GetInstance(locale); int[] scriptCodes = IBM.ICU.Lang.UScript.GetCode(locale); if (scriptCodes == null) { if (locale.ToString().IndexOf(("in")) < 0) { Errln("UScript.getCode returned null for locale: " + locale); } continue; } UnicodeSet[] exemplarSets = new UnicodeSet[4]; for (int k = 0; k < 2; ++k) { // for casing option in (normal, // uncased) int option = (k == 0) ? 0 : IBM.ICU.Text.UnicodeSet.CASE; for (int h = 0; h < 2; ++h) { int type = (h == 0) ? IBM.ICU.Util.LocaleData.ES_STANDARD : IBM.ICU.Util.LocaleData.ES_AUXILIARY; UnicodeSet exemplarSet = ld.GetExemplarSet(option, type); exemplarSets[k * 2 + h] = exemplarSet; LocaleDataTest.ExemplarGroup exGrp = new LocaleDataTest.ExemplarGroup(exemplarSet, scriptCodes); if (!ILOG.J2CsMapping.Collections.Collections.Contains(exGrp, testedExemplars)) { ILOG.J2CsMapping.Collections.Generics.Collections.Add(testedExemplars, exGrp); UnicodeSet[] sets = new UnicodeSet[scriptCodes.Length]; // create the UnicodeSets for the script for (int j = 0; j < scriptCodes.Length; j++) { sets[j] = new UnicodeSet("[:" + IBM.ICU.Lang.UScript.GetShortName(scriptCodes[j]) + ":]"); } bool existsInScript = false; UnicodeSetIterator iter = new UnicodeSetIterator( exemplarSet); // iterate over the while (!existsInScript && iter.NextRange()) { if (iter.codepoint != IBM.ICU.Text.UnicodeSetIterator.IS_STRING) { for (int j_0 = 0; j_0 < sets.Length; j_0++) { if (sets[j_0].Contains(iter.codepoint, iter.codepointEnd)) { existsInScript = true; break; } } } else { for (int j_1 = 0; j_1 < sets.Length; j_1++) { if (sets[j_1].Contains(iter.str0)) { existsInScript = true; break; } } } } // TODO: How to verify LocaleData.ES_AUXILIARY ??? if (existsInScript == false && h == 0) { Errln("ExemplarSet containment failed for locale,option,type : " + locale + ", " + option + ", " + type); } } } } // This is expensive, so only do it if it will be visible if (IsVerbose()) { Logln(locale.ToString() + " exemplar(ES_STANDARD)" + exemplarSets[0]); Logln(locale.ToString() + " exemplar(ES_AUXILIARY) " + exemplarSets[1]); Logln(locale.ToString() + " exemplar(case-folded,ES_STANDARD) " + exemplarSets[2]); Logln(locale.ToString() + " exemplar(case-folded,ES_AUXILIARY) " + exemplarSets[3]); } AssertTrue(locale.ToString() + " case-folded is a superset", exemplarSets[2].ContainsAll(exemplarSets[0])); AssertTrue(locale.ToString() + " case-folded is a superset", exemplarSets[3].ContainsAll(exemplarSets[1])); if (exemplarSets[2].Equals(exemplarSets[0])) { ++equalCount; } if (exemplarSets[3].Equals(exemplarSets[1])) { ++equalCount; } } // Note: The case-folded set should sometimes be a strict superset // and sometimes be equal. AssertTrue( "case-folded is sometimes a strict superset, and sometimes equal", equalCount > 0 && equalCount < availableLocales.Length * 2); }
public override Collator CreateCollator(ULocale loc) { return(@delegate.CreateCollator(loc)); }
/// <summary> /// Convenience overload of <see cref="GetInstance(CultureInfo, DisplayContext[])"/> that specifies /// <see cref="DisplayContext.StandardNames"/>. /// </summary> /// <param name="locale">The display <see cref="CultureInfo"/>.</param> /// <returns>A <see cref="LocaleDisplayNames"/> instance.</returns> /// <stable>ICU 54</stable> public static LocaleDisplayNames GetInstance(CultureInfo locale) { return(GetInstance(ULocale.ForLocale(locale))); }
public void TestRegisterFactory() { ULocale fu_FU = new ULocale("fu_FU"); ULocale fu_FU_FOO = new ULocale("fu_FU_FOO"); IDictionary <object, object> fuFUNames = new Dictionary <object, object> { { fu_FU, "ze leetle bunny Fu-Fu" }, { fu_FU_FOO, "zee leetel bunny Foo-Foo" }, { ULocale.US, "little bunny Foo Foo" } }; Collator frcol = Collator.GetInstance(ULocale.FRANCE); /* Collator uscol = */ Collator.GetInstance(ULocale.US); Collator gecol = Collator.GetInstance(ULocale.GERMANY); Collator jpcol = Collator.GetInstance(ULocale.JAPAN); Collator fucol = Collator.GetInstance(fu_FU); CollatorInfo[] info = { new CollatorInfo(ULocale.US, frcol, null), new CollatorInfo(ULocale.FRANCE, gecol, null), new CollatorInfo(fu_FU, jpcol, fuFUNames), }; TestFactory factory = null; try { factory = new TestFactory(info); } catch (MissingManifestResourceException ex) { Warnln("Could not load locale data."); } // coverage { TestFactoryWrapper wrapper = new TestFactoryWrapper(factory); // in java, gc lets us easily multiply reference! Object key = Collator.RegisterFactory(wrapper); String name = null; try { name = Collator.GetDisplayName(fu_FU, fu_FU_FOO); } catch (MissingManifestResourceException ex) { Warnln("Could not load locale data."); } Logln("*** default name: " + name); Collator.Unregister(key); ULocale bar_BAR = new ULocale("bar_BAR"); Collator col = Collator.GetInstance(bar_BAR); ULocale valid = col.GetLocale(ULocale.VALID_LOCALE); String validName = valid.GetName(); if (validName.Length != 0 && !validName.Equals("root")) { Errln("Collation from bar_BAR is really \"" + validName + "\" but should be root"); } } int n1 = checkAvailable("before registerFactory"); { Object key = Collator.RegisterFactory(factory); int n2 = checkAvailable("after registerFactory"); Collator ncol = Collator.GetInstance(ULocale.US); if (!frcol.Equals(ncol)) { Errln("frcoll for en_US failed"); } ncol = Collator.GetInstance(fu_FU_FOO); if (!jpcol.Equals(ncol)) { Errln("jpcol for fu_FU_FOO failed, got: " + ncol); } ULocale[] locales = Collator.GetAvailableULocales(); bool found = false; for (int i = 0; i < locales.Length; ++i) { if (locales[i].Equals(fu_FU)) { found = true; break; } } if (!found) { Errln("new locale fu_FU not reported as supported locale"); } String name = Collator.GetDisplayName(fu_FU); if (!"little bunny Foo Foo".Equals(name)) { Errln("found " + name + " for fu_FU"); } name = Collator.GetDisplayName(fu_FU, fu_FU_FOO); if (!"zee leetel bunny Foo-Foo".Equals(name)) { Errln("found " + name + " for fu_FU in fu_FU_FOO"); } if (!Collator.Unregister(key)) { Errln("failed to unregister factory"); } int n3 = checkAvailable("after unregister"); assertTrue("register increases count", n2 > n1); assertTrue("unregister restores count", n3 == n1); ncol = Collator.GetInstance(fu_FU); if (!fucol.Equals(ncol)) { Errln("collator after unregister does not match original fu_FU"); } } }
// names for entire locales /// <summary> /// Returns the display name of the provided <paramref name="locale"/>. /// When no display names are available for all or portions /// of the original locale ID, those portions may be /// used directly (possibly in a more canonical form) as /// part of the returned display name. /// </summary> /// <param name="locale">The locale whose display name to return.</param> /// <returns>The display name of the provided <paramref name="locale"/>.</returns> /// <stable>ICU 4.4</stable> public abstract string LocaleDisplayName(ULocale locale);
public void TestGetKeywordValues() { String[][] PREFERRED = { new string[] { "und", "standard", "eor", "search" }, new string[] { "en_US", "standard", "eor", "search" }, new string[] { "en_029", "standard", "eor", "search" }, new string[] { "de_DE", "standard", "phonebook", "search", "eor"}, new string[] { "de_Latn_DE", "standard", "phonebook", "search", "eor"}, new string[] { "zh", "pinyin", "stroke", "eor", "search", "standard"}, new string[] { "zh_Hans", "pinyin", "stroke", "eor", "search", "standard"}, new string[] { "zh_CN", "pinyin", "stroke", "eor", "search", "standard"}, new string[] { "zh_Hant", "stroke", "pinyin", "eor", "search", "standard"}, new string[] { "zh_TW", "stroke", "pinyin", "eor", "search", "standard"}, new string[] { "zh__PINYIN", "pinyin", "stroke", "eor", "search", "standard"}, new string[] { "es_ES", "standard", "search", "traditional", "eor"}, new string[] { "es__TRADITIONAL", "traditional", "search", "standard", "eor"}, new string[] { "und@collation=phonebook", "standard", "eor", "search" }, new string[] { "de_DE@collation=big5han", "standard", "phonebook", "search", "eor"}, new string[] { "zzz@collation=xxx", "standard", "eor", "search" }, }; for (int i = 0; i < PREFERRED.Length; i++) { String locale = PREFERRED[i][0]; ULocale loc = new ULocale(locale); String[] expected = PREFERRED[i]; String[] pref = Collator.GetKeywordValuesForLocale("collation", loc, true); for (int j = 1; j < expected.Length; ++j) { if (!arrayContains(pref, expected[j])) { Errln("Keyword value " + expected[j] + " missing for locale: " + locale); } } // Collator.getKeywordValues return the same contents for both commonlyUsed // true and false. String[] all = Collator.GetKeywordValuesForLocale("collation", loc, false); bool matchAll = false; if (pref.Length == all.Length) { matchAll = true; for (int j = 0; j < pref.Length; j++) { bool foundMatch = false; for (int k = 0; k < all.Length; k++) { if (pref[j].Equals(all[k])) { foundMatch = true; break; } } if (!foundMatch) { matchAll = false; break; } } } if (!matchAll) { Errln("FAIL: All values for locale " + loc + " got:" + Arrays.ToString(all) + " expected:" + Arrays.ToString(pref)); } } }
public override string LocaleDisplayName(CultureInfo locale) { return(ULocale.ForLocale(locale).GetName()); }
private static BreakIterator CreateBreakInstance(ULocale locale, int kind) { RuleBasedBreakIterator iter = null; ICUResourceBundle rb = ICUResourceBundle. GetBundleInstance(ICUData.IcuBreakIteratorBaseName, locale, OpenType.LocaleRoot); // // Get the binary rules. // ByteBuffer bytes = null; string typeKeyExt = null; if (kind == BreakIterator.KIND_LINE) { string lbKeyValue = locale.GetKeywordValue("lb"); if (lbKeyValue != null && (lbKeyValue.Equals("strict") || lbKeyValue.Equals("normal") || lbKeyValue.Equals("loose"))) { typeKeyExt = "_" + lbKeyValue; } } try { string typeKey = (typeKeyExt == null) ? KIND_NAMES[kind] : KIND_NAMES[kind] + typeKeyExt; string brkfname = rb.GetStringWithFallback("boundaries/" + typeKey); string rulesFileName = ICUData.IcuBreakIteratorName + '/' + brkfname; bytes = ICUBinary.GetData(rulesFileName); } catch (Exception e) { throw new MissingManifestResourceException(e.ToString(), e /*, "", ""*/); } // // Create a normal RuleBasedBreakIterator. // try { #pragma warning disable 612, 618 iter = RuleBasedBreakIterator.GetInstanceFromCompiledRules(bytes); #pragma warning restore 612, 618 } catch (IOException e) { // Shouldn't be possible to get here. // If it happens, the compiled rules are probably corrupted in some way. Assert.Fail(e); } // TODO: Determine valid and actual locale correctly. ULocale uloc = ULocale.ForLocale(rb.GetLocale()); iter.SetLocale(uloc, uloc); iter.BreakType = kind; // filtered break if (kind == BreakIterator.KIND_SENTENCE) { string ssKeyword = locale.GetKeywordValue("ss"); if (ssKeyword != null && ssKeyword.Equals("standard")) { ULocale @base = new ULocale(locale.GetBaseName()); return(FilteredBreakIteratorBuilder.GetInstance(@base).WrapIteratorWithFilter(iter)); } } return(iter); }
internal GetDisplayThread(String name, ICUService service_0, long delay_1, ULocale locale_2, TestLog log_3) : base("DIS " + name, service_0, delay_1, log_3) { this.locale = locale_2; }
public override object RegisterInstance(BreakIterator iter, ULocale locale, int kind) { iter.SetText(new StringCharacterIterator("")); return(service.RegisterObject(iter, locale, kind)); }
//////////////////////// /// START PUBLIC API /// //////////////////////// public ICUCurrencyDisplayInfo(ULocale locale, ICUResourceBundle rb, bool fallback) { this.locale = locale; this.fallback = fallback; this.rb = rb; }
protected override object HandleCreate(ULocale loc, int kind, ICUService srvc) { return(CreateBreakInstance(loc, kind)); }
/// <summary> /// Constructs a GregorianCalendar based on the current time in the default /// time zone with the given locale. /// </summary> /// /// <param name="locale">the given ulocale.</param> /// @stable ICU 3.2 public GregorianCalendar(ULocale locale) : this(IBM.ICU.Util.TimeZone.GetDefault(), locale) { }
public ICUDataTable(string path, ULocale locale, bool nullIfNotFound) : base(nullIfNotFound) { this.bundle = (ICUResourceBundle)UResourceBundle.GetBundleInstance( path, locale.GetBaseName()); }