Class ResourceKeyHandler
Performs different operations on resource keys for LocalizationService.
Inheritance
Inherited Members
Namespace: EPiServer.Framework.Localization
Assembly: EPiServer.Framework.dll
Version: 10.10.4Syntax
[ServiceConfiguration(Lifecycle = ServiceInstanceScope.Singleton)]
public class ResourceKeyHandlerConstructors
ResourceKeyHandler()
Initializes a new instance of the ResourceKeyHandler class.
Declaration
public ResourceKeyHandler()ResourceKeyHandler(ServiceAccessor<HttpContextBase>)
Initializes a new instance of the ResourceKeyHandler class.
Declaration
[Obsolete("Use alternative constructor")]
public ResourceKeyHandler(ServiceAccessor<HttpContextBase> contextLoader)Parameters
| Type | Name | Description | 
|---|---|---|
| ServiceAccessor<System.Web.HttpContextBase> | contextLoader | The method that will provide the current HttpContext. If null, the System.Web.HttpContext.Current will be used. | 
Fields
ComplexResourceKeyIdentifier
The character that if present at the start of the resource key, identifies that it is a key that is made up of multiple sections.
Declaration
public static readonly char ComplexResourceKeyIdentifierField Value
| Type | Description | 
|---|---|
| System.Char | 
ComplexResourceKeySeparator
The character that separates the different parts of a complex key.
Declaration
public static readonly char ComplexResourceKeySeparatorField Value
| Type | Description | 
|---|---|
| System.Char | 
ContextBasedResourceKeyIdentifier
The character that if present at the start of the resource key, identifies that it is a context based key that should be resolved based on the current request path.
Declaration
[Obsolete("Context based identifiers are added through AddContextResolver")]
public static readonly char ContextBasedResourceKeyIdentifierField Value
| Type | Description | 
|---|---|
| System.Char | 
Methods
AddLanguageKeyResolver(Char, ILanguageKeyResolver)
Adds a custom language key resolver.
Declaration
public void AddLanguageKeyResolver(char contextIdentifier, ILanguageKeyResolver contextResolver)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Char | contextIdentifier | The character that each resourcejey should start with to be handed by the resolver | 
| ILanguageKeyResolver | contextResolver | The resolver | 
IsComplexKey(String)
Determines whether the specified key is a complex resource key, i.e. made up by multiple sections.
Declaration
public virtual bool IsComplexKey(string key)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | key | The key to test. | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
 | 
JoinKey(String, String[])
Joins a normalized key back into a single key string.
Declaration
public virtual string JoinKey(string originalKey, string[] normalizedKey)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | originalKey | |
| System.String[] | normalizedKey | 
Returns
| Type | Description | 
|---|---|
| System.String | 
NormalizeKey(String)
Normalizes the resource key to an array of key parts split on forward slash (/) or a custom path resolver.
Declaration
public virtual string[] NormalizeKey(string resourceKey)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | resourceKey | The resource key to normalize. | 
Returns
| Type | Description | 
|---|---|
| System.String[] | An normalized array with key parts. | 
Remarks
Raises the KeyNormalized event once normalization is complete. This event allows for external code to modify the standard normalization behavior.
A custom
ResolveContextBasedKey(String)
Resolves a resource key based on the current request path.
Declaration
[Obsolete("No longer used, context based keys are resolved through IContextBasedKeyResolver instances")]
public virtual string ResolveContextBasedKey(string resourceKey)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | resourceKey | The resource key to resolve. | 
Returns
| Type | Description | 
|---|---|
| System.String | A key that has the current request path added to the beginning of the key. | 
TransformResourceKey(String)
Transforms a resource key that has the character "." as separator to a key with slashes as separator.
Declaration
public virtual string TransformResourceKey(string resourceKeyWithDotSeparator)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | resourceKeyWithDotSeparator | A resource key with dot as separator. | 
Returns
| Type | Description | 
|---|---|
| System.String | A resource key with slash as separator. | 
Examples
From A.Resource.Key to /A/Resource/Key
