public virtual string GetText(string msgid, string msgcomment, LanguageItem[] languages, out LanguageTag o_langtag, int maxPasses = -1)
        {
            string      s1;
            LanguageTag lt = LanguageMatching.MatchLists(
                languages,
                m_appLanguages.Values,
                msgid,
                null,
                out s1,
                maxPasses);

            //
            o_langtag = lt;
            if (lt.IsValid())
            {
                return(string.Format("{0}{1}{2}", prefix, msgid, suffix));
            }
            return(null);
        }
        public virtual string GetText(string msgid, string msgcomment, LanguageItem[] languages, out LanguageTag o_langtag, int maxPasses = -1)
        {
            string      s1;
            LanguageTag lt = LanguageMatching.MatchLists(
                languages,
                m_appLanguages.Values,
                msgid,
                null,
                out s1,
                maxPasses);

            //
            o_langtag = lt;
            if (!lt.IsValid())
            {
                return(null);
            }
            if (this.msgid != msgid)
            {
                return(null);
            }
            return(msgstr);
        }
        public ActionResult SetLanguage(string langtag, string returnUrl)
        {
            // If valid 'langtag' passed.
            LanguageTag lt = LanguageTag.GetCachedInstance(langtag);

            if (lt.IsValid())
            {
                // Set persistent cookie in the client to remember the language choice.
                Response.Cookies.Add(new HttpCookie("i18n.langtag")
                {
                    Value    = lt.ToString(),
                    HttpOnly = true,
                    Expires  = DateTime.UtcNow.AddYears(1)
                });
            }
            // Owise...delete any 'language' cookie in the client.
            else
            {
                var cookie = Response.Cookies["i18n.langtag"];
                if (cookie != null)
                {
                    cookie.Value   = null;
                    cookie.Expires = DateTime.UtcNow.AddMonths(-1);
                }
            }
            // Update PAL setting so that new language is reflected in any URL patched in the
            // response (Late URL Localization).
            HttpContext.SetPrincipalAppLanguageForRequest(lt);
            // Patch in the new langtag into any return URL.
            if (returnUrl.IsSet())
            {
                returnUrl = LocalizedApplication.Current.UrlLocalizerForApp.SetLangTagInUrlPath(HttpContext, returnUrl, UriKind.RelativeOrAbsolute, lt == null ? null : lt.ToString()).ToString();
            }
            // Redirect user agent as approp.
            Bootstrapper.Run();
            return(Redirect(returnUrl));
        }