public static string ExecuteTranslateNameOrDescr(L10N data, bool isName, string lang = null) { if (data == null) { data = new L10N(); data.InitializeField(); } return(isName ? ExecuteLang(data, lang).Name ?? "" : ExecuteLang(data, lang).Description ?? ""); }
private static LangField ExecuteLang(L10N data, string lang = null) { lang = lang?.ToLower() ?? data.CurrentCulture; if (lang == SupportedCulture[(byte)LangKeys.En]) { return(data.En); } if (lang == SupportedCulture[(byte)LangKeys.Ru]) { return(data.Ru); } return((lang == SupportedCulture[(byte)LangKeys.Es]) ? data.Es : data.En); }
public static LangField ExecuteLang(string data, string lang = null) { var tmp = new L10N(); tmp.InitializeField(); if (string.IsNullOrWhiteSpace(data)) { return(ExecuteLang(tmp, lang)); } var instance = data.ToSpecificModel <L10N>(); tmp.En = instance.En ?? tmp.En; tmp.Ru = instance.Ru ?? tmp.Ru; tmp.Es = instance.Es ?? tmp.Es; return(ExecuteLang(tmp, lang)); }
protected L10N(L10N other) : this() { En = other.En.CreateNewFromThis(); Es = other.Es.CreateNewFromThis(); Ru = other.Ru.CreateNewFromThis(); }
public L10N CreateNew(L10N other) { return(new L10N(other)); }