// AddNewLang adds a new <language, dictionary<key-phrase, value>> to the langCollection, // and initializes the <key-phrase,value> dictionary with the key-set of the other languages and an empty string value, // else if there are no other languages, initializes an empty dictionary public void AddNewLang(string newLang) { if (!langs.Contains(newLang)) { langs.Add(newLang); DictionaryStringString dict = new DictionaryStringString(); foreach (string key in keyPhrases) { dict.Add(key, ""); } langCollection.Add(newLang, dict); Debug.Log("added language " + newLang); Debug.Log("now list of languages is"); foreach (string lang in langCollection.Keys) { Debug.Log(lang); } } }
// AddNewKey iterates through the languages and adds the specified key // to each languages <key-phrase,value> dictionary public void AddNewKey(string key) { if (!keyPhrases.Contains(key)) { keyPhrases.Add(key); foreach (string lang in langs) { Debug.Log("adding key " + key + " to lang " + lang); DictionaryStringString dict = langCollection[lang]; dict.Add(key, ""); langCollection[lang] = dict; } Debug.Log("added new key: " + key); raiseKeyUpdate(); } else { Debug.Log("key already exists: " + key); } }