// Token: 0x06000CCD RID: 3277 RVA: 0x003DB3DC File Offset: 0x003D95DC private void LoadFilesForCulture(GameCulture culture) { string[] languageFilesForCulture = this.GetLanguageFilesForCulture(culture); for (int i = 0; i < languageFilesForCulture.Length; i++) { string text = languageFilesForCulture[i]; try { string text2 = LanguageManager.ReadEmbeddedResource(text); if (text2 == null || text2.Length < 2) { throw new FileFormatException(); } this.LoadLanguageFromFileText(text2); } catch (Exception) { if (Debugger.IsAttached) { Debugger.Break(); } Console.WriteLine("Failed to load language file: " + text); break; } } }
private void LoadFilesForCulture(GameCulture culture) { string[] languageFilesForCulture = GetLanguageFilesForCulture(culture); foreach (string text in languageFilesForCulture) { try { string text2 = Utils.ReadEmbeddedResource(text); if (text2 == null || text2.Length < 2) { //throw new FileFormatException(); } LoadLanguageFromFileText(text2); } catch (Exception) { if (Debugger.IsAttached) { Debugger.Break(); } Console.WriteLine("Failed to load language file: " + text); return; } } }
private static void RegisterLegacyCulture(GameCulture culture, int legacyId) { if (GameCulture._legacyCultures == null) { GameCulture._legacyCultures = new Dictionary <int, GameCulture>(); } GameCulture._legacyCultures.Add(legacyId, culture); }
private void LoadLanguage(GameCulture culture) { LoadFilesForCulture(culture); if (this.OnLanguageChanging != null) { this.OnLanguageChanging(this); } ProcessCopyCommandsInTexts(); }
private void LoadFilesForCulture(GameCulture culture) { LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".json")); LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".Game.json")); LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".Items.json")); LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".Legacy.json")); LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".NPCs.json")); LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".Projectiles.json")); LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".Town.json")); LoadLanguageFromFileText(File.ReadAllText("Localisation/" + culture.Name + "/" + culture.Name + ".Mobile.json")); }
private void LoadLanguage(GameCulture culture) { this.LoadFilesForCulture(culture); // ISSUE: reference to a compiler-generated field if (this.OnLanguageChanging != null) { // ISSUE: reference to a compiler-generated field this.OnLanguageChanging(this); } this.ProcessCopyCommandsInTexts(); }
private string[] GetLanguageFilesForCulture(GameCulture culture) { Assembly.GetExecutingAssembly(); return(Array.FindAll <string>(typeof(Program).Assembly.GetManifestResourceNames(), (Predicate <string>)(element => { if (element.StartsWith("Terraria.Localization.Content." + culture.CultureInfo.Name)) { return element.EndsWith(".json"); } return false; }))); }
static GameCulture() { _NamedCultures = new Dictionary <CultureName, GameCulture> { { CultureName.English, new GameCulture("en-US", 1) }, { CultureName.German, new GameCulture("de-DE", 2) }, { CultureName.Italian, new GameCulture("it-IT", 3) }, { CultureName.French, new GameCulture("fr-FR", 4) }, { CultureName.Spanish, new GameCulture("es-ES", 5) }, { CultureName.Russian, new GameCulture("ru-RU", 6) }, { CultureName.Chinese, new GameCulture("zh-Hans", 7) }, { CultureName.Portuguese, new GameCulture("pt-BR", 8) }, { CultureName.Polish, new GameCulture("pl-PL", 9) } }; DefaultCulture = _NamedCultures[CultureName.English]; }
// Token: 0x06000CCB RID: 3275 RVA: 0x003DB334 File Offset: 0x003D9534 public void SetLanguage(GameCulture culture) { if (this.ActiveCulture == culture) { return; } if (culture != this._fallbackCulture && this.ActiveCulture != this._fallbackCulture) { this.SetAllTextValuesToKeys(); this.LoadLanguage(this._fallbackCulture); } this.LoadLanguage(culture); this.ActiveCulture = culture; Thread.CurrentThread.CurrentCulture = culture.CultureInfo; Thread.CurrentThread.CurrentUICulture = culture.CultureInfo; if (this.OnLanguageChanged != null) { this.OnLanguageChanged(this); } }
public void SetLanguage(GameCulture culture) { if (ActiveCulture != culture) { if (culture != _fallbackCulture && ActiveCulture != _fallbackCulture) { SetAllTextValuesToKeys(); LoadLanguage(_fallbackCulture); } LoadLanguage(culture); ActiveCulture = culture; Thread.CurrentThread.CurrentCulture = culture.CultureInfo; Thread.CurrentThread.CurrentUICulture = culture.CultureInfo; if (this.OnLanguageChanged != null) { this.OnLanguageChanged(this); } SpriteFont fontMouseText = Main.fontMouseText; } }
public void SetLanguage(GameCulture culture) { if (ActiveCulture != culture) { if (culture != _fallbackCulture && ActiveCulture != _fallbackCulture) { SetAllTextValuesToKeys(); LoadLanguage(_fallbackCulture); } LoadLanguage(culture); ActiveCulture = culture; Thread.CurrentThread.CurrentCulture = culture.CultureInfo; Thread.CurrentThread.CurrentUICulture = culture.CultureInfo; if (this.OnLanguageChanged != null) { this.OnLanguageChanged(this); } _ = FontAssets.DeathText; } }
private string[] GetLanguageFilesForCulture(GameCulture culture) { Assembly.GetExecutingAssembly(); return(Array.FindAll <string>(typeof(Program).Assembly.GetManifestResourceNames(), (Predicate <string>)(element => { var elementArgs = element.Split('.'); if (elementArgs.Length < 4) { return false; } var resLanguage = elementArgs[3].Replace('_', '-'); if (resLanguage.CompareTo(culture.Name) == 0 && element.EndsWith(".json")) { return true; } else { return false; } }))); }
public void SetLanguage(GameCulture culture) { if (this.ActiveCulture == culture) { return; } if (culture != this._fallbackCulture && this.ActiveCulture != this._fallbackCulture) { this.SetAllTextValuesToKeys(); this.LoadLanguage(this._fallbackCulture); } this.LoadLanguage(culture); this.ActiveCulture = culture; Thread.CurrentThread.CurrentCulture = culture.CultureInfo; Thread.CurrentThread.CurrentUICulture = culture.CultureInfo; // ISSUE: reference to a compiler-generated field if (this.OnLanguageChanged == null) { return; } // ISSUE: reference to a compiler-generated field this.OnLanguageChanged(this); }
private void LoadFilesForCulture(GameCulture culture) { foreach (string path in this.GetLanguageFilesForCulture(culture)) { try { string fileText = LanguageManager.ReadEmbeddedResource(path); if (fileText == null || fileText.Length < 2) { throw new FileFormatException(); } this.LoadLanguageFromFileText(fileText); } catch (Exception ex) { if (Debugger.IsAttached) { Debugger.Break(); } Console.WriteLine("Failed to load language file: " + path); break; } } }
public GameCulture(string name, int legacyId) { this.CultureInfo = new CultureInfo(name); this.LegacyId = legacyId; GameCulture.RegisterLegacyCulture(this, legacyId); }
private string[] GetLanguageFilesForCulture(GameCulture culture) { Assembly.GetExecutingAssembly(); return(Array.FindAll(typeof(Program).Assembly.GetManifestResourceNames(), (string element) => element.StartsWith("Terraria.Localization.Content." + culture.CultureInfo.Name) && element.EndsWith(".json"))); }
public void SetLanguage(string cultureName) { GameCulture language = GameCulture.FromName(cultureName); SetLanguage(language); }
public void SetLanguage(int legacyId) { GameCulture language = GameCulture.FromLegacyId(legacyId); SetLanguage(language); }
public void SetFallbackCulture(GameCulture culture) { _fallbackCulture = culture; }
public void SetLanguage(string cultureName) { this.SetLanguage(GameCulture.FromName(cultureName)); }
public void SetLanguage(int legacyId) { this.SetLanguage(GameCulture.FromLegacyId(legacyId)); }