private void Check(String type, ULocale locale, String[] codes, Object[] contextList, DisplayNameTest.DisplayNameGetter getter) { if (contextList == null) { contextList = NO_CONTEXT; } for (int k = 0; k < contextList.Length; ++k) { codeToName[k].Clear(); } for (int j = 0; j < codes.Length; ++j) { String code = codes[j]; for (int k_0 = 0; k_0 < contextList.Length; ++k_0) { Object context = contextList[k_0]; String name = getter.Get(locale, code, context); if (name == null || name.Length == 0) { Errln("Null or Zero-Length Display Name\t" + type + "\t(" + ((context != null) ? (Object)(context) : (Object)("")) + ")" + ":\t" + locale + " [" + locale.GetDisplayName(IBM.ICU.Util.ULocale.ENGLISH) + "]" + "\t" + code + " [" + getter.Get(IBM.ICU.Util.ULocale.ENGLISH, code, context) + "]"); continue; } String otherCode = (String)ILOG.J2CsMapping.Collections.Collections.Get(codeToName[k_0], name); if (otherCode != null) { Errln("Display Names collide for\t" + type + "\t(" + ((context != null) ? (Object)(context) : (Object)("")) + ")" + ":\t" + locale + " [" + locale.GetDisplayName(IBM.ICU.Util.ULocale.ENGLISH) + "]" + "\t" + code + " [" + getter.Get(IBM.ICU.Util.ULocale.ENGLISH, code, context) + "]" + "\t& " + otherCode + " [" + getter.Get(IBM.ICU.Util.ULocale.ENGLISH, otherCode, context) + "]" + "\t=> " + name); } else { ILOG.J2CsMapping.Collections.Collections.Put(codeToName[k_0], name, code); if (SHOW_ALL) { Logln(type + " (" + ((context != null) ? (Object)(context) : (Object)("")) + ")" + "\t" + locale + " [" + locale.GetDisplayName(IBM.ICU.Util.ULocale.ENGLISH) + "]" + "\t" + code + "[" + getter.Get(IBM.ICU.Util.ULocale.ENGLISH, code, context) + "]" + "\t=> " + name); } } } } }
private UiListItem NewRow(ULocale modified, DisplayContext capContext) { ULocale minimized = ULocale.MinimizeSubtags(modified, ULocale.Minimize.FAVOR_SCRIPT); string tempName = modified.GetDisplayName(locale); bool titlecase = capContext == DisplayContext.CapitalizationForUIListOrMenu; string nameInDisplayLocale = titlecase ? ToTitleWholeStringNoLowercase(locale, tempName) : tempName; tempName = modified.GetDisplayName(modified); string nameInSelf = capContext == DisplayContext.CapitalizationForUIListOrMenu ? ToTitleWholeStringNoLowercase(modified, tempName) : tempName; return(new UiListItem(minimized, modified, nameInDisplayLocale, nameInSelf)); }
public void TestULocale() { ULocale defLoc = IBM.ICU.Util.ULocale.GetDefault(); IBM.ICU.Util.ULocale.SetDefault(_DEFAULT_LOCALE); for (int i = 0; i < _LOCALE_NUMBER; i++) { ULocale oldLoc = _LOCALES[i][0]; ULocale newLoc = _LOCALES[i][1]; if (ILOG.J2CsMapping.Collections.Collections.Get(availableMap, _LOCALES[i][1]) == null) { Logln(_LOCALES[i][1] + " is not available. Skipping!"); continue; } ULocale ul1 = new ULocale(oldLoc.ToString()); ULocale ul2 = new ULocale(newLoc.ToString()); String name1 = ul1.GetDisplayName(); String name2 = ul2.GetDisplayName(); if (!name1.Equals(name2)) { Errln("name1!=name2. name1 = " + name1 + " name2 = " + name2); } Logln("ULocale(getDisplayName) old:" + name1 + " new:" + name2); } IBM.ICU.Util.ULocale.SetDefault(defLoc); }
/// <summary> /// Return the name of the collator for the objectLocale, localized for /// the displayLocale. If objectLocale is not visible or not defined by /// the factory, return null. /// </summary> /// /// <param name="objectLocale">the locale identifying the collator</param> /// <param name="displayLocale">the locale for which the display name of the collatorshould be localized</param> /// <returns>the display name</returns> /// @stable ICU 3.2 public String GetDisplayName(ULocale objectLocale, ULocale displayLocale) { if (Visible()) { ILOG.J2CsMapping.Collections.ISet supported = GetSupportedLocaleIDs(); String name = objectLocale.GetBaseName(); if (ILOG.J2CsMapping.Collections.Collections.Contains(name, supported)) { return(objectLocale.GetDisplayName(displayLocale)); } } return(null); }
/// <summary> /// Return a localized name for the locale represented by id. /// </summary> public virtual string GetDisplayName(string id, ULocale locale) { // assume if the user called this on us, we must have handled some fallback of this id // if (isSupportedID(id)) { if (locale == null) { return(id); } ULocale loc = new ULocale(id); return(loc.GetDisplayName(locale)); // } // return null; }
internal string GetDisplayName(ULocale displayLocale) { string name = null; if (displayNames != null) { name = displayNames.TryGetValue(displayLocale, out object val) ? (string)val : null; } if (name == null) { name = locale.GetDisplayName(displayLocale); } return(name); }
internal String GetDisplayName(ULocale displayLocale) { String name = null; if (displayNames != null) { name = (String)displayNames.Get(displayLocale); } if (name == null) { name = locale.GetDisplayName(displayLocale); } return(name); }