public static void SetLanguageToAr(HttpContext currentContext) { Thread.CurrentThread.CurrentUICulture = new CultureInfo("ar-SA"); if (CookiesHandler.GetLanguageFromCookie(currentContext) != "Arabic") { CookiesHandler.UpdateLanguageCookie(currentContext, "Arabic"); } }
public static void SetLanguageToEn(HttpContext currentContext) { Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US"); if (CookiesHandler.GetLanguageFromCookie(currentContext) != "English") { CookiesHandler.UpdateLanguageCookie(currentContext, "English"); } }
public static String HandleCultureName(HttpContext currentContext = null) { string cookieLanguage = currentContext == null ? null : CookiesHandler.GetLanguageFromCookie(currentContext); if (cookieLanguage == "Arabic") { SetLanguageToAr(currentContext); } else if (cookieLanguage == "English") { SetLanguageToEn(currentContext); } return(Thread.CurrentThread.CurrentUICulture.TextInfo.CultureName.Split(new char[] { '-' })[0]); }