public static void LoadLocalizations(string cultureName) { LocalizationData newData = new LocalizationData(CultureInfo.GetCultureInfo(cultureName)); foreach (var source in GetSources()) { foreach (var pair in source.GetTranslations(cultureName)) { newData.Add(pair.Key, pair.Value); } } _current = newData; }
public IEnumerable <KeyValuePair <string, string> > GetTranslations(string cultureName) { string file = Path.Combine(_path, cultureName) + ".json"; if (File.Exists(file)) { JToken token = JToken.Parse(File.ReadAllText(file)); LocalizationData data = ObjectPipeline.BuildObject <LocalizationData>(token); foreach (var pair in data) { yield return(pair); } } }