Class JsonResourceSerializer
Provides convenient access to culture-specific client resources at run time Use GetResourcesAsJson to get the JSON object.
Inheritance
Inherited Members
Namespace: EPiServer.Shell.Resources
Assembly: EPiServer.Shell.dll
Version: 8.11.0Syntax
public class JsonResourceSerializer : ResourceManager
Constructors
JsonResourceSerializer(Type)
Initializes a new instance of the JsonResourceSerializer class.
Declaration
public JsonResourceSerializer(Type resourceType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | resourceType | A System.Type from which the System.Resources.ResourceManager derives all information for finding .resources files. |
Methods
GetMergedResources(CultureInfo)
Merges the resources for cultureInfo with the neutral resources
Declaration
protected virtual Dictionary<string, string> GetMergedResources(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | The culture you want your resources in |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | Dictionary containing the merged resources |
Remarks
Will only return resources that are of type System.String
GetResourcesAsJson(CultureInfo)
Gets the resources as a JSON object. The Resources for the cultre are merged with the neutral cultures for the type which resource manager were created for. This means that if you are asking for a resource in Swedish and it does not exist you will get the resource in the language which the assmbly has set as neutral.
Declaration
public virtual string GetResourcesAsJson(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
System.Globalization.CultureInfo | culture | The culture you want your resources in. |
Returns
Type | Description |
---|---|
System.String | A string representing the JSON object. "{[ResourceKey]:[ResourceValue], [ResourceKey]:[ResourceValue]}" |
Remarks
Will only return resources that are of type System.String