private string GetRegionDisplayName(string region, bool skipAdjust) { if (displayContextOptions.DisplayLength == DisplayLength.Short) { string regionName2 = regionData.Get("Countries%short", region); if (regionName2 != null && !regionName2.Equals(region)) { return(skipAdjust ? regionName2 : AdjustForUsageAndContext(CapitalizationContextUsage.Territory, regionName2)); } } string regionName = regionData.Get("Countries", region); return(skipAdjust ? regionName : AdjustForUsageAndContext(CapitalizationContextUsage.Territory, regionName)); }
public override void Init() { App.On(ApplicationEvents.OnApplicationStartComplete, (sender, e) => { ICsvStore csvStore = App.Make <ICsvStore>(); // csv 文件需要遵守 rfc4180 规范才能被解析 // csvStore仅仅是用作存储csv文件,这里的用法已经涉及到 datatable 组件 // 开发者可用理解csv store 仅仅就是存储csv的容器 IDataTable table = csvStore["items"]; // 使用 datatable 的 active record 进行查询(更多datatable的用法参考datatable的demo) // (type == 2 || level < 3) && job == 2 table.Where((selector) => { selector.Where("type", "=", "2").OrWhere("level", "<", "3"); }).Where("job", "=", "2"); foreach (var row in table.Get()) { UnityEngine.Debug.Log(row["name"]); } }); }
private string LocaleIdName(string localeId) { if (displayContextOptions.DisplayLength == DisplayLength.Short) { string locIdName = langData.Get("Languages%short", localeId); if (locIdName != null && !locIdName.Equals(localeId)) { return(locIdName); } } return(langData.Get("Languages", localeId)); }
public DataTableCultureDisplayNames(UCultureInfo culture, DisplayContextOptions options) #pragma warning disable 612, 618 : base() #pragma warning restore 612, 618 { this.displayContextOptions = options.Freeze(); this.langData = languageDataTableProvider.GetDataTable(culture, options.SubstituteHandling == SubstituteHandling.NoSubstitute); this.regionData = regionDataTableProvider.GetDataTable(culture, options.SubstituteHandling == SubstituteHandling.NoSubstitute); this.locale = langData.CultureInfo != null && langData.CultureInfo.Equals(CultureInfo.InvariantCulture) ? regionData.CultureInfo.ToUCultureInfo() : langData.CultureInfo.ToUCultureInfo(); // Note, by going through DataTable, this uses table lookup rather than straight lookup. // That should get us the same data, I think. This way we don't have to explicitly // load the bundle again. Using direct lookup didn't seem to make an appreciable // difference in performance. string sep = langData.Get("localeDisplayPattern", "separator"); if (sep == null || "separator".Equals(sep)) { sep = "{0}, {1}"; } StringBuilder sb = new StringBuilder(); this.separatorFormat = SimpleFormatterImpl.CompileToStringMinMaxArguments(sep, sb, 2, 2); string pattern = langData.Get("localeDisplayPattern", "pattern"); if (pattern == null || "pattern".Equals(pattern)) { pattern = "{0} ({1})"; } this.format = SimpleFormatterImpl.CompileToStringMinMaxArguments(pattern, sb, 2, 2); if (pattern.Contains("(")) { formatOpenParen = '('; formatCloseParen = ')'; formatReplaceOpenParen = '['; formatReplaceCloseParen = ']'; } else { formatOpenParen = '('; formatCloseParen = ')'; formatReplaceOpenParen = '['; formatReplaceCloseParen = ']'; } string keyTypePattern = langData.Get("localeDisplayPattern", "keyTypePattern"); if (keyTypePattern == null || "keyTypePattern".Equals(keyTypePattern)) { keyTypePattern = "{0}={1}"; } this.keyTypeFormat = SimpleFormatterImpl.CompileToStringMinMaxArguments( keyTypePattern, sb, 2, 2); // Get values from the contextTransforms data if we need them // Also check whether we will need a break iterator (depends on the data) bool needBrkIter = false; if (options.Capitalization == Capitalization.UIListOrMenu || options.Capitalization == Capitalization.Standalone) { capitalizationUsage = new bool[Enum.GetValues(typeof(CapitalizationContextUsage)).Length]; // initialized to all false ICUResourceBundle rb = (ICUResourceBundle)UResourceBundle.GetBundleInstance(ICUData.IcuBaseName, locale); CapitalizationContextSink sink = new CapitalizationContextSink(this); try { rb.GetAllItemsWithFallback("contextTransforms", sink); } catch (MissingManifestResourceException) { // Silently ignore. Not every locale has contextTransforms. } needBrkIter = sink.hasCapitalizationUsage; } // Get a sentence break iterator if we will need it if (needBrkIter || options.Capitalization == Capitalization.BeginningOfSentence) { capitalizationBrkIter = BreakIterator.GetSentenceInstance(locale); } this.currencyDisplayInfo = CurrencyData.Provider.GetInstance(locale, false); }