internal static string ResourceString(HttpContextBase httpContext, string classKey, string resourceKey) { try { return(ResourceExtensions.GetResourceString(httpContext, classKey, resourceKey)); } catch (Exception ex) { TagBuilder tagBuilder = new TagBuilder("span"); tagBuilder.AddCssClass("help-inline translation-missing alert alert-warning"); tagBuilder.InnerHtml = ex.Message; return(tagBuilder.ToString()); } }
/// <summary> /// Renders the resource. /// </summary> /// <param name="helper">The helper.</param> /// <param name="classKey">The class key.</param> /// <param name="resourceKey">The resource key.</param> public static void RenderResource(this HtmlHelper helper, string classKey, string resourceKey) { string value = ResourceExtensions.ResourceString(helper.ViewContext.HttpContext, classKey, resourceKey); helper.ViewContext.Writer.WriteLine(value); }
/// <summary> /// Resources the specified helper. /// </summary> /// <param name="helper">The helper.</param> /// <param name="classKey">The class key.</param> /// <param name="resourceKey">The resource key.</param> /// <returns></returns> public static MvcHtmlString Resource(this HtmlHelper helper, string classKey, params string[] resourceKey) { return(ResourceExtensions.ResourceString(helper.ViewContext.HttpContext, classKey, string.Join("_", resourceKey)).ToMvcHtmlString()); }