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

Class LocalizationOptions

Contains various options that controls how Localization in EPiServer is setup.

Inheritance
System.Object
LocalizationOptions
Namespace: EPiServer.Framework.Localization
Assembly: EPiServer.Framework.dll
Version: 12.0.3
Syntax
[Options(ConfigurationSection = "Cms")]
public class LocalizationOptions : Object

Constructors

LocalizationOptions()

Declaration
public LocalizationOptions()

Properties

FallbackBehavior

Specifies which fallback behaviour to use when a localization string does not exist.

Declaration
public FallbackBehaviors FallbackBehavior { get; set; }
Property Value
Type Description
FallbackBehaviors
Remarks

Default value is FallbackBehaviors.FallbackCulture | FallbackBehaviors.Echo

FallbackCulture

Specifies which fallback culture that is used when a localization string does not exist in a specific language.

Declaration
public CultureInfo FallbackCulture { get; set; }
Property Value
Type Description
System.Globalization.CultureInfo
Remarks

The default value is CultureInfo.GetCultureInfo("en")

Providers

The localizations providers that should be used by ProviderBasedLocalizationService.

Declaration
public IList<LocalizationProviderBuilder> Providers { get; }
Property Value
Type Description
System.Collections.Generic.IList<LocalizationProviderBuilder>

Methods

AddProvider<TProvider>()

Adds a LocalizationProvider of the given type.

Declaration
public LocalizationOptions AddProvider<TProvider>()
    where TProvider : LocalizationProvider
Returns
Type Description
LocalizationOptions
Type Parameters
Name Description
TProvider

The type of provider to add.

Remarks

The provider will be assigned a randomly generated name.

AddProvider<TProvider, TProviderOptions>(Action<TProviderOptions>)

Adds a LocalizationProvider of the given type using the provided method to configure the provider options.

Declaration
public LocalizationOptions AddProvider<TProvider, TProviderOptions>(Action<TProviderOptions> configure)
    where TProvider : LocalizationProvider where TProviderOptions : class, new()
Parameters
Type Name Description
System.Action<TProviderOptions> configure

Configuration method for setting up provider options.

Returns
Type Description
LocalizationOptions
Type Parameters
Name Description
TProvider

The type of provider to add.

TProviderOptions

The type of the options class expected by the specific provider type.

Remarks

The provider will be assigned a randomly generated name.

InsertProvider<TProvider>()

Inserts a LocalizationProvider to the top of the Providers list.

Declaration
public LocalizationOptions InsertProvider<TProvider>()
    where TProvider : LocalizationProvider
Returns
Type Description
LocalizationOptions
Type Parameters
Name Description
TProvider

The type of provider to add.

Remarks

The provider will be assigned a randomly generated name.

InsertProvider<TProvider, TProviderOptions>(Action<TProviderOptions>)

Inserts a LocalizationProvider to the top of the Providers list using the provided method to configure the provider options.

Declaration
public LocalizationOptions InsertProvider<TProvider, TProviderOptions>(Action<TProviderOptions> configure)
    where TProvider : LocalizationProvider where TProviderOptions : class, new()
Parameters
Type Name Description
System.Action<TProviderOptions> configure

Configuration method for setting up provider options.

Returns
Type Description
LocalizationOptions
Type Parameters
Name Description
TProvider

The type of provider to add.

TProviderOptions

The type of the options class expected by the specific provider type.

Remarks

The provider will be assigned a randomly generated name.

Extension Methods