November Happy Hour will be moved to Thursday December 5th.

Class MemoryLocalizationService

Unsupported INTERNAL API! Not covered by semantic versioning; might change without notice. A memory based implementation of LocalizationService intended for unit test usage.

Inheritance
System.Object
MemoryLocalizationService
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: 10.10.4
Syntax
public class MemoryLocalizationService : LocalizationService

Constructors

MemoryLocalizationService()

Initializes a new instance of the MemoryLocalizationService class.

Declaration
public MemoryLocalizationService()

MemoryLocalizationService(ResourceKeyHandler)

Initializes a new instance of the MemoryLocalizationService class.

Declaration
public MemoryLocalizationService(ResourceKeyHandler keyHandler)
Parameters
Type Name Description
ResourceKeyHandler keyHandler

The handler used to manipulate resource keys.

Properties

AvailableLocalizations

Gets all available localizations that the LocalizationService has knowledge of.

Declaration
public override IEnumerable<CultureInfo> AvailableLocalizations { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Globalization.CultureInfo>
Overrides

Methods

AddString(CultureInfo, String, String)

Adds a string to the MemoryLocalizationService dictionary.

Declaration
public void AddString(CultureInfo culture, string resourceKey, string value)
Parameters
Type Name Description
System.Globalization.CultureInfo culture

The culture that the string should be associated with.

System.String resourceKey

The key that the string should be associated with.

System.String value

The string value.

ClearStrings()

Removes all strings from the MemoryLocalizationService dictionary.

Declaration
public void ClearStrings()

ClearStrings(CultureInfo)

Removes all strings from the MemoryLocalizationService dictionary for a specific culture.

Declaration
public void ClearStrings(CultureInfo culture)
Parameters
Type Name Description
System.Globalization.CultureInfo culture

The culture to clear all strings from.

GetAllStringsByCulture(String, String[], CultureInfo)

Gets all localized strings for the specified culture below the specified key.

Declaration
protected override IEnumerable<ResourceItem> GetAllStringsByCulture(string originalKey, string[] normalizedKey, CultureInfo culture)
Parameters
Type Name Description
System.String originalKey

The original key that was passed into any GetString method.

System.String[] normalizedKey

The originalKey normalized and split into an array

System.Globalization.CultureInfo culture

The requested culture for the localized strings.

Returns
Type Description
System.Collections.Generic.IEnumerable<ResourceItem>

All localized strings below the specified key.

Overrides
See Also
GetStringByCulture(System.String, System.Globalization.CultureInfo)

LoadString(String[], String, CultureInfo)

Gets the localized string for the specified key in the specified culture.

Declaration
protected override string LoadString(string[] normalizedKey, string originalKey, CultureInfo culture)
Parameters
Type Name Description
System.String[] normalizedKey

The originalKey normalized and split into an array

System.String originalKey

The original key that was passed into any GetString method.

System.Globalization.CultureInfo culture

The requested culture for the localized string.

Returns
Type Description
System.String

A localized string or null if no resource is found for the given key and culture.

Overrides
See Also
GetStringByCulture(System.String, System.Globalization.CultureInfo)

RemoveString(CultureInfo, String)

Removes a string from the MemoryLocalizationService dictionary.

Declaration
public void RemoveString(CultureInfo culture, string resourceKey)
Parameters
Type Name Description
System.Globalization.CultureInfo culture

The culture that the string is associated with.

System.String resourceKey

The key that the string is associated with.

Extension Methods