public static string Get(string key, Language language) { var languages = LocalizationImporter.GetLanguages(key); var selected = (int)language; if (languages.Count > 0 && selected >= 0 && selected < languages.Count) { var currentString = languages[selected]; if (string.IsNullOrEmpty(currentString) || LocalizationImporter.IsLineBreak(currentString)) { Debug.LogWarning("Could not find key " + key + " for current language " + language + ". Falling back to " + Instance.fallbackLanguage + " with " + languages[(int)Instance.fallbackLanguage]); selected = (int)Instance.fallbackLanguage; currentString = languages[selected]; } #if ARABSUPPORT_ENABLED if (selected == (int)Language.Arabic) { return(ArabicSupport.ArabicFixer.Fix(currentString)); } #endif return(currentString); } return(string.Format(KeyNotFound, key)); }
public static string Get(string key, Language language) { var languages = LocalizationImporter.GetLanguages(key); var selected = (int)language; if (languages.Count > 0 && selected >= 0 && selected < languages.Count) { var currentString = languages[selected]; if (string.IsNullOrEmpty(currentString) || LocalizationImporter.IsLineBreak(currentString)) { Debug.LogWarning("Could not find key " + key + " for current language " + language + ". Falling back to " + Instance.fallbackLanguage + " with " + languages[(int)Instance.fallbackLanguage]); // EDIT: Cytoid // Default Fujaoese to Simplified Chinese selected = language == Language.Fujaoese ? (int)Language.Simplified_Chinese : (int)Instance.fallbackLanguage; currentString = languages[selected]; } #if ARABSUPPORT_ENABLED if (selected == (int)Language.Arabic) { return(ArabicSupport.ArabicFixer.Fix(currentString, instance.showTashkeel, instance.useHinduNumbers)); } #endif return(currentString); } return(string.Format(KeyNotFound, key)); }
/// <summary> /// Retreives the correct language string by key. /// </summary> /// <param name="key">The key string</param> /// <returns>A localized string</returns> public static string Get(string key) { var languages = LocalizationImporter.GetLanguages(key); var selected = (int)Instance.selectedLanguage; if (languages.Count > 0 && Instance.selectedLanguage >= 0 && selected < languages.Count) { var currentString = languages[selected]; if (string.IsNullOrEmpty(currentString) || LocalizationImporter.IsLineBreak(currentString)) { Debug.LogWarning("Could not find key " + key + " for current language " + Instance.selectedLanguage + ". Falling back to " + Instance.fallbackLanguage + " with " + languages[(int)Instance.fallbackLanguage]); currentString = languages[(int)Instance.fallbackLanguage]; } return(currentString); } return(string.Format(KeyNotFound, key)); }