public static LocalizationManager.Languages GetSetPlayerLanguage() { string l = PlayerPrefs.GetString(PLAYERLANGUAGE); LocalizationManager.Languages lang; if (EnumParse.TryParseEnum <LocalizationManager.Languages>(l, out lang)) { return(lang); } else { return(LocalizationManager.defaultLang); } }
public static Languages[] GetAvailableLanguages() { if (avariableLanguages == null) { List <Languages> listAvariableLang = new List <Languages>(); Languages selectedLanguage; #if UNITY_ANDROID || UNITY_IOS TextAsset[] languageFiles = Resources.LoadAll <TextAsset>(resourceLanguagesFiles); int ilang = languageFiles.Length; for (int i = 0; i < ilang; i++) { if (EnumParse.TryParseEnum <Languages>(Path.GetFileNameWithoutExtension(languageFiles[i].name), out selectedLanguage)) { listAvariableLang.Add(selectedLanguage); } } listAvariableLang.Sort(); avariableLanguages = listAvariableLang.ToArray(); #else string[] languageFiles = Directory.GetFiles(GetPoPath()); int ilang = languageFiles.Length; for (int i = 0; i < ilang; i++) { if (Path.GetExtension(languageFiles[i]) != ".po") { continue; } if (EnumParse.TryParseEnum <Languages>(Path.GetFileNameWithoutExtension(languageFiles[i]), out selectedLanguage)) { listAvariableLang.Add(selectedLanguage); } } listAvariableLang.Sort(); avariableLanguages = listAvariableLang.ToArray(); #endif } return(avariableLanguages); }