예제 #1
0
 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 ?? "");
 }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
 protected L10N(L10N other) : this()
 {
     En = other.En.CreateNewFromThis();
     Es = other.Es.CreateNewFromThis();
     Ru = other.Ru.CreateNewFromThis();
 }
예제 #5
0
 public L10N CreateNew(L10N other)
 {
     return(new L10N(other));
 }