private static void InitTraceControlEntry(IAttributeAccessor target, string resourceID, string processID) { target.SetAttribute("resourceID", resourceID); target.SetAttribute("feature", GetWindowFeature().ToWindowFeatureClientString()); ResourceUriSettings settings = ResourceUriSettings.GetConfig(); string path = "/MCSWebApp/OACommonPages/AppTrace/appTraceViewer.aspx"; if (settings.Paths.ContainsKey("appTrace")) { path = settings.Paths["appTrace"].Uri.ToString(); } target.SetAttribute("href", string.Format(path + "?resourceID={0}&processID={1}&{2}={3}", resourceID, processID, GlobalizationWebHelper.LanguageParameterName, HttpUtility.UrlEncode(GlobalizationWebHelper.GetCurrentHandlerLanguageID()))); target.SetAttribute("target", "WfTrace" + resourceID.Replace("-", string.Empty)); target.SetAttribute("onclick", "onWfTraceButtonClick()"); }
private static CultureInfo GetCultureInfo() { string language = TranslatorConfigSettings.GetConfig().DefaultCulture.Name; HttpRequest request = HttpContext.Current.Request; if (GlobalizationWebHelper.TryGetLanguageFromQueryString(ref language) == false) { if (HttpContext.Current.User != null && HttpContext.Current.User.Identity.IsAuthenticated) { try { if (TryGetLanguageFromTicket(ref language) == false) { IUserCultureInfoAccessor accessor = UserCultureInfoSettings.GetConfig().UserCultureInfoAccessor; if (accessor != null) { language = accessor.GetCurrentUserLanguageID(HttpContext.Current.User.Identity.Name, language); } } } catch (System.Exception ex) { WriteExceptionToLog(ex); } } } CultureInfo translatedCulture = null; int cultureID = 2052; if (int.TryParse(language, out cultureID)) { translatedCulture = new CultureInfo(cultureID); } else { translatedCulture = new CultureInfo(language); } translatedCulture.DateTimeFormat.DateSeparator = "-"; translatedCulture.DateTimeFormat.FullDateTimePattern = "yyyy-MM-dd HH:mm:ss"; translatedCulture.DateTimeFormat.LongDatePattern = "yyyy-MM-dd"; translatedCulture.DateTimeFormat.LongTimePattern = "HH:mm:ss"; translatedCulture.DateTimeFormat.ShortDatePattern = "yyyy-MM-dd"; translatedCulture.DateTimeFormat.ShortTimePattern = "HH:mm"; return(translatedCulture); }
private static string Translate(string sourceText) { CultureInfo culture = new CultureInfo(GlobalizationWebHelper.GetUserDefaultLanguage()); return(Translator.Translate(Define.DefaultCategory, sourceText, culture)); }