Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Class ResourceKeyHandler

Performs different operations on resource keys for LocalizationService.

Inheritance
System.Object
ResourceKeyHandler
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Framework.Localization
Assembly: EPiServer.Framework.dll
Version: 11.20.7
Syntax
[ServiceConfiguration(Lifecycle = ServiceInstanceScope.Singleton)]
public class ResourceKeyHandler

Constructors

ResourceKeyHandler()

Initializes a new instance of the ResourceKeyHandler class.

Declaration
public ResourceKeyHandler()

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 ComplexResourceKeyIdentifier
Field Value
Type Description
System.Char

ComplexResourceKeySeparator

The character that separates the different parts of a complex key.

Declaration
public static readonly char ComplexResourceKeySeparator
Field 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

true if the specified key is a complex key; otherwise, false.

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

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

Extension Methods