private List <string> GetSpecificLanguageList(LANGUAGE lang) { for (int i = 0; i < strings.Count; i++) { if (strings[i][0] == lang.ToString().ToLower()) { return(strings[i]); } } Debug.LogError("CSVLoader.cs - GetSpecificLanguageList - No list found for language :" + lang.ToString()); return(null); }
public string GetString(string key, LANGUAGE lang) { //lookup the index of the key int keyIndex = strings[0].IndexOf(key.ToLower()); if (keyIndex < 0) { Debug.LogWarning("CSVLoader.cs - GetString - No match for key " + key); return("No match for key :" + key); } //return the associated string in the right language list string rawKey = GetSpecificLanguageList(lang)[keyIndex]; if (rawKey == "") { Debug.LogWarning("CSVLoader.cs - GetString - Key " + key + " exist but no translation is available in language :" + currentLanguage.ToString()); return(key + "/" + currentLanguage.ToString()); } return(rawKey); }