public static string GetBestGuessForLocale() { string result = "enUS"; bool flag = false; string text = MobileDeviceLocale.GetLanguageCode(); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, ref result); } catch (Exception) { } if (!flag) { text = text.Substring(0, 2); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, ref result); } catch (Exception) { } } if (!flag) { int num = 1; string countryCode = MobileDeviceLocale.GetCountryCode(); try { MobileDeviceLocale.s_countryCodeToRegionId.TryGetValue(countryCode, ref num); } catch (Exception) { } string text2 = text; if (text2 != null) { if (MobileDeviceLocale.< > f__switch$map7 == null) { Dictionary <string, int> dictionary = new Dictionary <string, int>(2); dictionary.Add("es", 0); dictionary.Add("zh", 1); MobileDeviceLocale.< > f__switch$map7 = dictionary; } int num2; if (MobileDeviceLocale.< > f__switch$map7.TryGetValue(text2, ref num2)) { if (num2 == 0) { if (num == 1) { result = "esMX"; } else { result = "esES"; } return(result); } if (num2 == 1) { if (countryCode == "CN") { result = "zhCN"; } else { result = "zhTW"; } return(result); } } } result = "enUS"; } return(result); }
public static string GetBestGuessForLocale() { string result = "enUS"; bool flag = false; string text = MobileDeviceLocale.GetLanguageCode(); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, out result); } catch (Exception) { } if (!flag) { text = text.Substring(0, 2); try { flag = MobileDeviceLocale.s_languageCodeToLocale.TryGetValue(text, out result); } catch (Exception) { } } if (!flag) { int num = 1; string countryCode = MobileDeviceLocale.GetCountryCode(); try { MobileDeviceLocale.s_countryCodeToRegionId.TryGetValue(countryCode, out num); } catch (Exception) { } if (text != null) { if (text == "es") { if (num == 1) { result = "esMX"; } else { result = "esES"; } return(result); } if (text == "zh") { if (countryCode == "CN") { result = "zhCN"; } else { result = "zhTW"; } return(result); } } result = "enUS"; } return(result); }