public int GetLocalInt(string key, string culture, int defaultValue) { var config = ListLanguage.Find(c => c.Keyword == key && c.Specificulture == culture); if (!int.TryParse(config?.Value, out int result)) { result = defaultValue; } return(result); }
public bool UpdateLanguage(string key, string culture, string value) { var config = ListLanguage.Find(c => c.Keyword == key && c.Specificulture == culture); string oldValue = config.Value; config.Value = value; var result = BELanguageViewModel.Repository.SaveModel(config); if (result.IsSucceed) { Translator[culture][key] = value; return(true); } else { config.Value = oldValue; return(false); } }
public string GetLocalString(string key, string culture, string defaultValue) { var config = ListLanguage.Find(c => c.Keyword == key && c.Specificulture == culture); return(config != null ? config.Value : defaultValue); }