using System; using System.Collections.Generic; using UnityEngine;

// Token: 0x02000246 RID: 582 public static class Localization { // Token: 0x17000242 RID: 578 // (get) Token: 0x06000FA1 RID: 4001 RVA: 0x00043A06 File Offset: 0x00041C06 // (set) Token: 0x06000FA2 RID: 4002 RVA: 0x00043A28 File Offset: 0x00041C28 public static Dictionary<string, string[]> dictionary { get { if (!Localization.localizationHasBeenSet) { Localization.language = PlayerPrefs.GetString("Language", "English"); } return Localization.mDictionary; } set { Localization.localizationHasBeenSet = value != null; Localization.mDictionary = value; } }

// Token: 0x17000243 RID: 579 // (get) Token: 0x06000FA3 RID: 4003 RVA: 0x00043A39 File Offset: 0x00041C39 public static string[] knownLanguages { get { if (!Localization.localizationHasBeenSet) { Localization.LoadDictionary(PlayerPrefs.GetString("Language", "English")); } return Localization.mLanguages; } }

// Token: 0x17000244 RID: 580 // (get) Token: 0x06000FA4 RID: 4004 RVA: 0x00043A5C File Offset: 0x00041C5C // (set) Token: 0x06000FA5 RID: 4005 RVA: 0x00043AA7 File Offset: 0x00041CA7 public static string language { get { if (string.IsNullOrEmpty(Localization.mLanguage)) { string[] knownLanguages = Localization.knownLanguages; Localization.mLanguage = PlayerPrefs.GetString("Language", (knownLanguages != null) ? knownLanguages[0] : "English"); Localization.LoadAndSelect(Localization.mLanguage); } return Localization.mLanguage; } set { if (Localization.mLanguage != value) { Localization.mLanguage = value; Localization.LoadAndSelect(value); } } }

// Token: 0x06000FA6 RID: 4006 RVA: 0x00043AC4 File Offset: 0x00041CC4 private static bool LoadDictionary(string value) { TextAsset textAsset = (Localization.localizationHasBeenSet ? null : (Resources.Load("Localization", typeof(TextAsset)) as TextAsset)); Localization.localizationHasBeenSet = true; if (textAsset != null && Localization.LoadCSV(textAsset)) { return true; } if (string.IsNullOrEmpty(value)) { return false; } textAsset = Resources.Load(value, typeof(TextAsset)) as TextAsset; if (textAsset != null) { Localization.Load(textAsset); return true; } return false; }

// Token: 0x06000FA7 RID: 4007 RVA: 0x00043B40 File Offset: 0x00041D40 private static bool LoadAndSelect(string value) { if (!string.IsNullOrEmpty(value)) { if (Localization.mDictionary.Count == 0 && !Localization.LoadDictionary(value)) { return false; } if (Localization.SelectLanguage(value)) { return true; } } if (Localization.mOldDictionary.Count > 0) { return true; } Localization.mOldDictionary.Clear(); Localization.mDictionary.Clear(); if (string.IsNullOrEmpty(value)) { PlayerPrefs.DeleteKey("Language"); } return false; }

// Token: 0x06000FA8 RID: 4008 RVA: 0x00043BAC File Offset: 0x00041DAC public static void Load(TextAsset asset) { ByteReader byteReader = new ByteReader(asset); Localization.Set(asset.name, byteReader.ReadDictionary()); }

// Token: 0x06000FA9 RID: 4009 RVA: 0x00043BD4 File Offset: 0x00041DD4 public static bool LoadCSV(TextAsset asset) { ByteReader byteReader = new ByteReader(asset); BetterList<string> betterList = byteReader.ReadCSV(); if (betterList.size < 2) { return false; } betterList[0] = "KEY"; if (!string.Equals(betterList[0], "KEY")) { Dbg.LogError("Invalid localization CSV file. The first value is expected to be 'KEY', followed by language columns.\nInstead found '" + betterList[0] + "'", asset, EDebugPerson.ALL); return false; } Localization.mLanguages = new string[betterList.size - 1]; for (int i = 0; i < Localization.mLanguages.Length; i++) { Localization.mLanguages[i] = betterList[i + 1]; } Localization.mDictionary.Clear(); while (betterList != null) { Localization.AddCSV(betterList); betterList = byteReader.ReadCSV(); } return true; }

// Token: 0x06000FAA RID: 4010 RVA: 0x00043C8C File Offset: 0x00041E8C private static bool SelectLanguage(string language) { Localization.mLanguageIndex = -1; if (Localization.mDictionary.Count == 0) { return false; } string[] array; if (Localization.mDictionary.TryGetValue("KEY", out array)) { for (int i = 0; i < array.Length; i++) { if (array[i] == language) { Localization.mOldDictionary.Clear(); Localization.mLanguageIndex = i; Localization.mLanguage = language; PlayerPrefs.SetString("Language", Localization.mLanguage); UIRoot.Broadcast("OnLocalize"); return true; } } } return false; }

// Token: 0x06000FAB RID: 4011 RVA: 0x00043D0C File Offset: 0x00041F0C private static void AddCSV(BetterList<string> values) { if (values.size < 2) { return; } string[] array = new string[values.size - 1]; for (int i = 1; i < values.size; i++) { array[i - 1] = values[i]; } try { Localization.mDictionary.Add(values[0], array); } catch (Exception ex) { Dbg.LogError("Unable to add '" + values[0] + "' to the Localization dictionary.\n" + ex.Message, EDebugPerson.ALL); } }

// Token: 0x06000FAC RID: 4012 RVA: 0x00043D98 File Offset: 0x00041F98 public static void Set(string languageName, Dictionary<string, string> dictionary) { Localization.mLanguage = languageName; PlayerPrefs.SetString("Language", Localization.mLanguage); Localization.mOldDictionary = dictionary; Localization.localizationHasBeenSet = false; Localization.mLanguageIndex = -1; Localization.mLanguages = new string[] { languageName }; UIRoot.Broadcast("OnLocalize"); }

// Token: 0x06000FAD RID: 4013 RVA: 0x00043DE8 File Offset: 0x00041FE8 public static string Get(string key) { if (!Localization.localizationHasBeenSet) { Localization.language = PlayerPrefs.GetString("Language", "English"); } string[] array; string text; if (Localization.mLanguageIndex != -1 && Localization.mDictionary.TryGetValue(key, out array)) { if (Localization.mLanguageIndex < array.Length) { return array[Localization.mLanguageIndex]; } } else if (Localization.mOldDictionary.TryGetValue(key, out text)) { return text; } return key; }

// Token: 0x17000245 RID: 581 // (get) Token: 0x06000FAE RID: 4014 RVA: 0x000021C0 File Offset: 0x000003C0 [Obsolete("Localization is now always active. You no longer need to check this property.")] public static bool isActive { get { return true; } }

// Token: 0x06000FAF RID: 4015 RVA: 0x00043E4B File Offset: 0x0004204B [Obsolete("Use Localization.Get instead")] public static string Localize(string key) { return Localization.Get(key); }

// Token: 0x06000FB0 RID: 4016 RVA: 0x00043E53 File Offset: 0x00042053 public static bool Exists(string key) { if (!Localization.localizationHasBeenSet) { Localization.language = PlayerPrefs.GetString("Language", "English"); } return Localization.mDictionary.ContainsKey(key) || Localization.mOldDictionary.ContainsKey(key); }

// Token: 0x040096E3 RID: 38627 public static bool localizationHasBeenSet = false;

// Token: 0x040096E4 RID: 38628 private static string[] mLanguages = null;

// Token: 0x040096E5 RID: 38629 private static Dictionary<string, string> mOldDictionary = new Dictionary<string, string>();

// Token: 0x040096E6 RID: 38630 private static Dictionary<string, string[]> mDictionary = new Dictionary<string, string[]>();

// Token: 0x040096E7 RID: 38631 private static int mLanguageIndex = -1;

// Token: 0x040096E8 RID: 38632 private static string mLanguage;

}

using System; using System.Collections.Generic; using UnityEngine;

// Token: 0x020000C0 RID: 192 public class LocalizationChartData : ChartDataObject<LocalizationDef, LocalizationChartData> { // Token: 0x17000075 RID: 117 // (get) Token: 0x06000338 RID: 824 RVA: 0x000021C0 File Offset: 0x000003C0 public override bool Localized { get { return true; } }

// Token: 0x17000076 RID: 118 // (get) Token: 0x06000339 RID: 825 RVA: 0x0000DC95 File Offset: 0x0000BE95 public override string DatabaseName { get { return "charts_localized"; } }

// Token: 0x0600033A RID: 826 RVA: 0x0000DC9C File Offset: 0x0000BE9C public static SystemLanguage GetCurrentSystemLanguage() { if (CoreManagerBase<CoreGlobalSettingsManager>.coreInstance != null) { return CoreManagerBase<CoreGlobalSettingsManager>.coreInstance.language; } return SystemLanguage.English; }

// Token: 0x0600033B RID: 827 RVA: 0x0000DCB8 File Offset: 0x0000BEB8 public static string GetLanguageAbbreviation(SystemLanguage inLanguage) { if (!LocalizationChartData.systemLanguageToAbbreviationMap.ContainsKey(inLanguage)) { return LocalizationChartData.systemLanguageToAbbreviationMap[SystemLanguage.English]; } return LocalizationChartData.systemLanguageToAbbreviationMap[inLanguage]; }

// Token: 0x0600033C RID: 828 RVA: 0x0000DCE0 File Offset: 0x0000BEE0 public static string GetCurrentLanguageAbbreviation() { if (CoreManagerBase<CoreGlobalSettingsManager>.coreInstance == null) { return LocalizationChartData.systemLanguageToAbbreviationMap[SystemLanguage.English]; } if (!LocalizationChartData.systemLanguageToAbbreviationMap.ContainsKey(GlobalSettingsManager.instance.language)) { return LocalizationChartData.systemLanguageToAbbreviationMap[SystemLanguage.English]; } return LocalizationChartData.systemLanguageToAbbreviationMap[CoreManagerBase<CoreGlobalSettingsManager>.coreInstance.language]; }

// Token: 0x0600033D RID: 829 RVA: 0x0000DD3E File Offset: 0x0000BF3E public static SystemLanguage GetSystemLanguageByAbbreviation(string abbreviation) { if (!LocalizationChartData.abbrevationToSystemLanguageMap.ContainsKey(abbreviation)) { return SystemLanguage.English; } return LocalizationChartData.abbrevationToSystemLanguageMap[abbreviation]; }

// Token: 0x0600033E RID: 830 RVA: 0x0000DD5B File Offset: 0x0000BF5B public static string Format(string inDefID, params object[] parameters) { return string.Format(LocalizationChartData.GetString(inDefID), parameters); }

// Token: 0x0600033F RID: 831 RVA: 0x0000DD69 File Offset: 0x0000BF69 public static string GetString(string inDefID) { if (CoreManagerBase<CoreChartDataManager>.coreInstance == null) { Debug.Break(); } return CoreManagerBase<CoreChartDataManager>.coreInstance.localizationChartData.Get(inDefID, "-1"); }

// Token: 0x06000340 RID: 832 RVA: 0x0000DD94 File Offset: 0x0000BF94 public string Get(string inDefID, string inDefault = "-1") { LocalizationDef localizationDef = ChartDataObject<LocalizationDef, LocalizationChartData>.GetDefWithDefID(inDefID, false); if (localizationDef == null) { localizationDef = ChartDataObject<LocalizationDef, SystemLocalizationChartData>.GetDefWithDefID(inDefID, false); } if (localizationDef != null) { return localizationDef.GetLocalizedStringWithLanguage(CoreManagerBase<CoreGlobalSettingsManager>.coreInstance.language); } Dbg.LogError("Unable to find Localization defID: " + inDefID, EDebugPerson.ALL); return inDefault; }

// Token: 0x04008DF1 RID: 36337 public static Dictionary<SystemLanguage, string> systemLanguageToAbbreviationMap = new Dictionary<SystemLanguage, string> { { SystemLanguage.English, "en" }, { SystemLanguage.French, "fr" }, { SystemLanguage.German, "de" }, { SystemLanguage.Spanish, "es" }, { SystemLanguage.Portuguese, "pt" }, { SystemLanguage.Russian, "ru" } };

// Token: 0x04008DF2 RID: 36338 public static Dictionary<string, SystemLanguage> abbrevationToSystemLanguageMap = new Dictionary<string, SystemLanguage> { { "en", SystemLanguage.English }, { "fr", SystemLanguage.French }, { "de", SystemLanguage.German }, { "es", SystemLanguage.Spanish }, { "pt", SystemLanguage.Portuguese }, { "ru", SystemLanguage.Russian } }; IGNORE_WHEN_COPYING_START content_copy download Use code with caution. IGNORE_WHEN_COPYING_END

}

using System; using UnityEngine;

// Token: 0x020000BF RID: 191 [Serializable] public class LocalizationDef : BaseDef { // Token: 0x06000333 RID: 819 RVA: 0x0000DB64 File Offset: 0x0000BD64 public override void LoadEntry() { base.LoadEntry(); if (CorePlatformUtils.IsStandalone) { string text = base.LoadString("OverrideStandalone_", "Missing"); if (BaseDef.isValidDefID(text)) { this.localizedString = LocalizationChartData.GetString(text); } else { this.localizedString = base.LoadString("String", null); } } else { this.localizedString = base.LoadString("String", null); } if (this.localizedString == null) { this.localizedString = base.LoadString(LocalizationChartData.GetCurrentLanguageAbbreviation(), "Missing"); } }

// Token: 0x06000334 RID: 820 RVA: 0x0000DBE9 File Offset: 0x0000BDE9 public string GetLocalizedStringWithLanguage(SystemLanguage inSystemLanguage) { if (!BaseDef.isValidDefID(this.localizedString)) { return "UNLOCALIZED: " + this.defID; } return this.localizedString; }

// Token: 0x17000074 RID: 116 // (get) Token: 0x06000335 RID: 821 RVA: 0x0000DC10 File Offset: 0x0000BE10 public bool IsFemale { get { string[] array = this.localizedString.Split(new char[] { '$' }); return array.Length > 1 && array[1][0] == 'f'; } }

// Token: 0x06000336 RID: 822 RVA: 0x0000DC4C File Offset: 0x0000BE4C public string GetAsMaleOrFemale(bool inFemale) { string[] array = this.localizedString.Split(new char[] { '$' }); string text = array[0]; string text2 = ((array.Length > 1) ? array[1] : array[0]); if (inFemale) { return text2; } return text; }

// Token: 0x04008DF0 RID: 36336 public string localizedString; IGNORE_WHEN_COPYING_START content_copy download Use code with caution. IGNORE_WHEN_COPYING_END

}

using System; using UnityEngine;

// Token: 0x0200036F RID: 879 [Serializable] public abstract class LocalizedNameBundledDef : BundledDef { // Token: 0x060019B4 RID: 6580 RVA: 0x0007ED44 File Offset: 0x0007CF44 public override void LoadEntry() { base.LoadEntry(); this.localizedNameID = base.LoadString("LocalizedName", "Missing"); }

// Token: 0x04009E8A RID: 40586 [Header("Localization")] public string localizedNameID; IGNORE_WHEN_COPYING_START content_copy download Use code with caution. IGNORE_WHEN_COPYING_END

}

Analyse this Animal Jam: Play Wild (Now Animal Jam) script in full detail