public override string GetDisplayName(string id, UCultureInfo locale) { string prefix = ""; string suffix = ""; string ls = locale.ToString(); if (LocaleUtility.IsFallbackOf(californio, ls)) { if (ls.Equals(valley, StringComparison.OrdinalIgnoreCase)) { prefix = "Like, you know, it's so totally "; } else if (ls.Equals(surfer, StringComparison.OrdinalIgnoreCase)) { prefix = "Dude, its "; } else if (ls.Equals(geek, StringComparison.OrdinalIgnoreCase)) { prefix = "I'd estimate it's approximately "; } else { prefix = "Huh? Maybe "; } } if (LocaleUtility.IsFallbackOf(californio, id)) { if (id.Equals(valley, StringComparison.OrdinalIgnoreCase)) { suffix = "like the Valley, you know? Let's go to the mall!"; } else if (id.Equals(surfer, StringComparison.OrdinalIgnoreCase)) { suffix = "time to hit those gnarly waves, Dude!!!"; } else if (id.Equals(geek, StringComparison.OrdinalIgnoreCase)) { suffix = "all systems go. T-Minus 9, 8, 7..."; } else { suffix = "No Habla Englais"; } } else { suffix = base.GetDisplayName(id, locale); } return(prefix + suffix); }
public Spec(string theSpec) { top = theSpec; spec = null; scriptName = null; try { // Canonicalize script name. If top is a script name then // script != UScript.INVALID_CODE. int script = UScript.GetCodeFromName(top); // Canonicalize script name -or- do locale->script mapping int[] s = UScript.GetCode(top); if (s != null) { scriptName = UScript.GetName(s[0]); // If the script name is the same as top then it's redundant if (scriptName.Equals(top, StringComparison.OrdinalIgnoreCase)) { scriptName = null; } } isSpecLocale = false; res = null; // If 'top' is not a script name, try a locale lookup if (script == UScript.InvalidCode) { // ICU4N specific - CultureInfo doesn't support IANA culture names, so we use ULocale instead. ULocale toploc = new ULocale(top); //CultureInfo toploc = LocaleUtility.GetLocaleFromName(top); res = (ICUResourceBundle)UResourceBundle.GetBundleInstance(ICUData.IcuTransliteratorBaseName, toploc, Transliterator.ICU_DATA_CLASS_LOADER); // Make sure we got the bundle we wanted; otherwise, don't use it if (res != null && LocaleUtility.IsFallbackOf(res.GetULocale().ToString(), top)) { isSpecLocale = true; } } } catch (MissingManifestResourceException) { ////CLOVER:OFF // The constructor is called from multiple private methods // that protects an invalid scriptName scriptName = null; ////CLOVER:ON } // assert(spec != top); Reset(); }