public static void LoadLang(string key) { SimpleLocaleLoader loader = new SimpleLocaleLoader(); loader.LoadDatabase(key); locale = loader.GetLoadedDatabase(); }
public void LoadDatabase(string name) { loadedDatabase = new LocaleDatabaseImpl(); Object[] langDatas = Resources.LoadAll("Lang/" + name, typeof(TextAsset)); if (langDatas != null) { foreach (Object textAsset in langDatas) { if (textAsset is TextAsset) { string[] lines = ((TextAsset)textAsset).text.Split('\n'); foreach (string line in lines) { string[] pair = line.Split(new char[] { '=' }, 2); if (pair.Length > 1) { pair[1] = pair[1].Replace("\r", string.Empty); ((LocaleDatabaseImpl)loadedDatabase).PutValue(pair[0], pair[1]); } } } } } }