Class JavaScriptResourceHandler

Http Handler that returns ASP.NET Local and Global Resources as JavaScript objects. Supports both plain Resx Resources as well as DbResourceProvider driven resources.

Objects are generated in the form of:

<>var localRes = { BackupFailed: "Backup was not completed", Loading: "Loading" );<>

where the resource key becomes the property name with a string value.

The handler is driven through query string variables determines which resources are returned:

ResourceSet - Examples: "resources" (global), "admin/somepage.aspx" "default.aspx" (local) LocaleId - Examples: "de-de","de","" (empty=invariant) ResourceType - Resx,ResDb IncludeControls - if non-blank includes control values (. in name) VarName - name of hte variable generated - if omitted localRes or globalRes is created. ResourceMode - Flag required to find Resx resources on disk 0 - Local 1 - global 2 - plain resx

Resources retrieved are aggregated for the locale Id (ie. de-de returns de-de,de and invariant) whichever matches first.

System.Object
  Westwind.Globalization.JavaScriptResourceHandler
public class JavaScriptResourceHandler : object, IHttpHandler

Class Members

MemberDescription

Constructor

GetJavaScriptGlobalResourcesUrl

Returns a URL to the JavaScriptResourceHandler.axd handler that retrieves normalized resources for a given resource set and localeId and creates a JavaScript object with the name specified.

This function returns only the URL - you're responsible for embedding the URL into the page as a script tag to actually load the resources.

public static string GetJavaScriptGlobalResourcesUrl(string varName,     string resourceSet,     string localeId,     ResourceProviderTypes resourceType)

public static string GetJavaScriptGlobalResourcesUrl(string varName,     string resourceSet)

GetJavaScriptLocalResourcesUrl

Inserts local resources into the current page.

public static string GetJavaScriptLocalResourcesUrl(string varName,     string localeId,     string resourceSet,     ResourceProviderTypes resourceType,     bool includeControls)

public static string GetJavaScriptLocalResourcesUrl(string varName,     bool includeControls)

GetJavaScriptResourcesUrl

Returns a standard Resx resource based on it's . delimited resourceset name

public static string GetJavaScriptResourcesUrl(string varName,     string resourceSet,     string localeId,     ResourceProviderTypes resourceType)

GetResourceSetFromCompiledResources

public Dictionary<String,Object> GetResourceSetFromCompiledResources(string resourceSet,     string baseNamespace)

ProcessRequest

public sealed void ProcessRequest(HttpContext context)

RegisterJavaScriptGlobalResources

Inserts global resources into the current page.

public static void RegisterJavaScriptGlobalResources(Control control,     string varName,     string resourceSet,     string localeId,     ResourceProviderTypes resourceType)

public static void RegisterJavaScriptGlobalResources(Control control,     string varName,     string resourceSet)

RegisterJavaScriptLocalResources

Inserts local resources into the current page.

public static void RegisterJavaScriptLocalResources(Control control,     string varName,     string localeId,     string resourceSet,     ResourceProviderTypes resourceType,     bool includeControls)

public static void RegisterJavaScriptLocalResources(Control control,     string varName)

IsReusable

Requirements

Namespace: Westwind.Globalization
Assembly: westwind.globalization.web.dll

© West Wind Technologies, 2006 - 2019 • Updated: 01/25/18
Comment or report problem with topic