public static string ProcStr(string str, CoreLanguageClass lang, CoreLanguageClass langPure) { MultiLanguageFilterStream st = new MultiLanguageFilterStream(null, lang, langPure, null, null); return(st.FilterString(str)); }
public static string ProcStr(string str, CoreLanguageClass lang, CoreLanguageClass langPure) { MultiLanguageFilterStream st = new MultiLanguageFilterStream(null, lang, langPure, null, null); return st.FilterString(str); }
public MultiLang(Page currentPage, bool fast, string basicHostName, List <KeyValuePair <string, string> > replaceList) { this.Page = currentPage; this.Request = Page.Request; this.Response = Page.Response; this.BasicHostName = basicHostName; string tmp = Page.Request.ServerVariables["HTTPS"]; string hostRaw = Page.Request.Headers["Host"]; this.ReplaceList = replaceList; bool isSsl = false; string[] tokens; string host = ""; tokens = hostRaw.Split(':'); if (tokens.Length >= 1) { host = tokens[0]; } host = host.ToLower(); if (tmp != null) { if (tmp.Equals("on", StringComparison.InvariantCultureIgnoreCase)) { isSsl = true; } } this.IsSSL = isSsl; this.Host = host; this.IsUrlModified = Str.StrToBool((string)Request.Headers["SEISAPI_MODIFIED_URL"]); this.OriginalUrl = (string)Request.Headers["SEISAPI_ORIGINAL_URL"]; int i; i = this.OriginalUrl.IndexOf("?"); if (i != -1) { this.OriginalUrl = this.OriginalUrl.Substring(0, i); } if (Str.IsEmptyStr(this.OriginalUrl) || this.IsUrlModified == false) { this.OriginalUrl = AspUtil.RemoveDefaultHtml(AspUtil.GetCurrentRequestUrl(Page)); } string s = (string)Request.Headers["SEISAPI_ORIGINAL_FILENAME"]; if (Str.IsEmptyStr(s) == false) { this.IsFilenameModified = true; this.OriginalFileName = s; this.OriginalFilePath = (string)Request.Headers["SEISAPI_ORIGINAL_FILEPATH"]; } string langCode = GetCurrentLangCodeFromPath(this.OriginalUrl); this.CurrentLanguage = CoreLanguageList.GetLanguageClassByName(langCode); this.CurrentLanguageCode = CurrentLanguage.Name; try { HtmlFileName = AspUtil.WebPathToFilePath(currentPage, AspUtil.GetCurrentRequestUrl(currentPage)); } catch { } if (this.IsFilenameModified) { HtmlFileName = Path.Combine(Path.GetDirectoryName(HtmlFileName), Path.GetFileName(OriginalFilePath)); } try { if (fast == false) { HtmlBody = File.ReadAllText(HtmlFileName, Str.Utf8Encoding); } } catch { } PhysicalUrl = AspUtil.RemoveDefaultHtml(AspUtil.GetCurrentRequestUrl((currentPage))); Args = currentPage.Request.ServerVariables["QUERY_STRING"]; if (CurrentLanguage == CoreLanguageList.Japanese) { IsCurrentLanguageSupported = true; } else { IsCurrentLanguageSupported = Str.SearchStr(HtmlBody, string.Format("<!-- ml:{0} -->", CurrentLanguage.Name), 0, false) != -1; } GoogleTranslateUrl = string.Format("http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=ja&tl={1}&u={0}", HttpUtility.UrlEncode((isSsl ? "https://" : "http://") + host + this.OriginalUrl, Str.Utf8Encoding), this.CurrentLanguageCode); OriginalFullUrl = (isSsl ? "https://" : "http://") + host + this.OriginalUrl; ContentsPrintLanguage = this.CurrentLanguage; if (IsCurrentLanguageSupported == false) { ContentsPrintLanguage = CoreLanguageList.Japanese; } if (fast == false) { mfs = new MultiLanguageFilterStream(Response.Filter, ContentsPrintLanguage, this.CurrentLanguage, this.BasicHostName, this.ReplaceList); mfs.Page = Page; Response.Filter = mfs; } }
public MultiLang(Page currentPage, bool fast, string basicHostName, List<KeyValuePair<string, string>> replaceList) { this.Page = currentPage; this.Request = Page.Request; this.Response = Page.Response; this.BasicHostName = basicHostName; string tmp = Page.Request.ServerVariables["HTTPS"]; string hostRaw = Page.Request.Headers["Host"]; this.ReplaceList = replaceList; bool isSsl = false; string[] tokens; string host = ""; tokens = hostRaw.Split(':'); if (tokens.Length >= 1) { host = tokens[0]; } host = host.ToLower(); if (tmp != null) { if (tmp.Equals("on", StringComparison.InvariantCultureIgnoreCase)) { isSsl = true; } } this.IsSSL = isSsl; this.Host = host; this.IsUrlModefied = Str.StrToBool((string)Request.Headers["SEISAPI_MODIFIED_URL"]); this.OriginalUrl = (string)Request.Headers["SEISAPI_ORIGINAL_URL"]; int i; i = this.OriginalUrl.IndexOf("?"); if (i != -1) { this.OriginalUrl = this.OriginalUrl.Substring(0, i); } if (Str.IsEmptyStr(this.OriginalUrl) || this.IsUrlModefied == false) { this.OriginalUrl = AspUtil.RemoveDefaultHtml(AspUtil.GetCurrentRequestUrl(Page)); } string s = (string)Request.Headers["SEISAPI_ORIGINAL_FILENAME"]; if (Str.IsEmptyStr(s) == false) { this.IsFilenameModified = true; this.OriginalFileName = s; this.OriginalFilePath = (string)Request.Headers["SEISAPI_ORIGINAL_FILEPATH"]; } string langCode = GetCurrentLangCodeFromPath(this.OriginalUrl); this.CurrentLanguage = CoreLanguageList.GetLanguageClassByName(langCode); this.CurrentLanguageCode = CurrentLanguage.Name; try { HtmlFileName = AspUtil.WebPathToFilePath(currentPage, AspUtil.GetCurrentRequestUrl(currentPage)); } catch { } if (this.IsFilenameModified) { HtmlFileName = Path.Combine(Path.GetDirectoryName(HtmlFileName), Path.GetFileName(OriginalFilePath)); } try { if (fast == false) { HtmlBody = File.ReadAllText(HtmlFileName, Str.Utf8Encoding); } } catch { } PhysicalUrl = AspUtil.RemoveDefaultHtml(AspUtil.GetCurrentRequestUrl((currentPage))); Args = currentPage.Request.ServerVariables["QUERY_STRING"]; if (CurrentLanguage == CoreLanguageList.Japanese) { IsCurrentLanguageSupported = true; } else { IsCurrentLanguageSupported = Str.SearchStr(HtmlBody, string.Format("<!-- ml:{0} -->", CurrentLanguage.Name), 0, false) != -1; } GoogleTranslateUrl = string.Format("http://translate.google.com/translate?js=n&prev=_t&hl=en&ie=UTF-8&layout=2&eotf=1&sl=ja&tl={1}&u={0}", HttpUtility.UrlEncode((isSsl ? "https://" : "http://") + host + this.OriginalUrl, Str.Utf8Encoding), this.CurrentLanguageCode); OriginalFullUrl = (isSsl ? "https://" : "http://") + host + this.OriginalUrl; ContentsPrintLanguage = this.CurrentLanguage; if (IsCurrentLanguageSupported == false) { ContentsPrintLanguage = CoreLanguageList.Japanese; } if (fast == false) { mfs = new MultiLanguageFilterStream(Response.Filter, ContentsPrintLanguage, this.CurrentLanguage, this.BasicHostName, this.ReplaceList); mfs.Page = Page; Response.Filter = mfs; } }