public void SwitchLanguage() { int lang = currentLanguage; lang++; if (lang == possibleLanguages.Length) { lang = 0; } SystemLanguage language = possibleLanguages[lang]; LanguageTextJsonContainer textJsonContainer = SystemLanguageFiles[DefaultSystemLanguage]; if (SystemLanguageFiles.ContainsKey(language)) { textJsonContainer = SystemLanguageFiles[language]; } if (textJsonContainer != null) { retrieveLocalizationText(textJsonContainer.JsonText, lang, language); } }
public void LoadSavedLanguage() { if (PlayerPrefs.HasKey("LangIndex")) { currentLanguage = PlayerPrefs.GetInt("LangIndex"); CurrentSystemLanguage = possibleLanguages[currentLanguage]; } else { CurrentSystemLanguage = DefaultSystemLanguage; } LanguageTextJsonContainer textJsonContainer = SystemLanguageFiles[DefaultSystemLanguage]; if (SystemLanguageFiles.ContainsKey(CurrentSystemLanguage)) { textJsonContainer = SystemLanguageFiles[CurrentSystemLanguage]; } if (textJsonContainer != null) { retrieveLocalizationText(textJsonContainer.JsonText, currentLanguage, CurrentSystemLanguage); } }