/// <summary> /// Get the resource string with the specified key from the resource files. /// </summary> /// <param name="helper">The helper.</param> /// <param name="key">The key.</param> /// <param name="fallbackToKey">If true then if a resource is not found with the specified key the key is returned.</param> public static string Resource(this HtmlHelper helper, string key, bool fallbackToKey = false) { var controller = helper.ViewContext.Controller; return(LocalizationHelpers.Resource(controller, helper.ViewContext.RouteData, key, fallbackToKey)); }
/// <summary> /// Get the label with the specified key from the resource files. /// </summary> /// <param name="controller">Controller that requests the resource.</param> /// <param name="key">The key.</param> public static string Label(IController controller, string key) { var resClass = LocalizationHelpers.FindResourceStringClassType(controller); return(Res.Get(resClass, key)); }