示例#1
0
        public string L(string key)
        {
            var restr       = string.Empty;
            var localcookie = GetCookies("__locallang");

            var localquery = HttpContext.Request.Query["lang"];

            if (!string.IsNullOrEmpty(localquery))
            {
                var lmodel = APPCommon.GetLoalLang(key, localquery).Result;
                restr = GetDefaultValue(key, ref lmodel);
                SetCookies("__locallang", localquery);
            }
            else
            {
                if (string.IsNullOrEmpty(localcookie))
                {
                    var lmodel = APPCommon.GetLoalLang(key, null, 0).Result;
                    restr = GetDefaultValue(key, ref lmodel);
                    restr = lmodel?.Value;
                }
                else
                {
                    var lmodel = APPCommon.GetLoalLang(key, localcookie).Result;
                    restr = GetDefaultValue(key, ref lmodel);
                    restr = lmodel.Value;
                }
            }
            return(restr);
        }
示例#2
0
        private static string GetDefaultValue(string key, ref LocalLangs lmodel)
        {
            string restr;

            if (lmodel == null)
            {
                lmodel = APPCommon.GetLoalLang(key, null, 0).Result;
            }
            if (lmodel == null)
            {
                restr = string.Empty;
            }
            else
            {
                restr = lmodel.Value;
            }

            return(restr);
        }
示例#3
0
        public string L(string key, string langName)
        {
            var s = APPCommon.GetLoalLang(key, langName).Result;

            return(s.Value);
        }
示例#4
0
        public string L(string key, int lang)
        {
            var s = APPCommon.GetLoalLang(key, null, lang).Result;

            return(s.Value);
        }