Class DefaultLocalizationInterceptor
- Namespace
- MudBlazor
- Assembly
- MudBlazor.dll
The DefaultLocalizationInterceptor manages translations, incorporating English as the default language, facilitating the addition of custom translations without imposing limitations on their implementation.
public class DefaultLocalizationInterceptor : AbstractLocalizationInterceptor, ILocalizationInterceptor
- Inheritance
-
DefaultLocalizationInterceptor
- Implements
- Inherited Members
- Extension Methods
Constructors
DefaultLocalizationInterceptor(ILoggerFactory, MudLocalizer?)
Initializes a new instance of the DefaultLocalizationInterceptor class.
public DefaultLocalizationInterceptor(ILoggerFactory loggerFactory, MudLocalizer? mudLocalizer = null)
Parameters
loggerFactory
ILoggerFactoryThe logger factory.
mudLocalizer
MudLocalizerThe optional custom MudLocalizer.
Properties
IgnoreDefaultEnglish
Gets or sets a value indicating whether to ignore default English translations.
public virtual bool IgnoreDefaultEnglish { get; init; }
Property Value
Methods
Handle(string, params object[])
public override LocalizedString Handle(string key, params object[] arguments)
Parameters
Returns
TranslationFallback(string)
Gets the string resource with the given name.
[Obsolete("Use TranslationWithFallback(string key, params object[] arguments) overload instead! Will be removed in v8.", true)]
protected virtual LocalizedString TranslationFallback(string key)
Parameters
key
stringThe name of the string resource
Returns
- LocalizedString
The string resource as a LocalizedString.
Remarks
This method is called when the default English translation is ignored or unavailable, and a custom MudLocalizer service implementation is registered. It attempts to use user-provided languages, falling back to the internal English translation if MudLocalizer is missing or no resource is found.
TranslationWithFallback(string, params object[])
Gets the string resource with the given name.
protected virtual LocalizedString TranslationWithFallback(string key, params object[] arguments)
Parameters
key
stringThe name of the string resource
arguments
object[]The list of arguments to be passed to the string resource
Returns
- LocalizedString
The string resource as a LocalizedString.
Remarks
This method is called when the default English translation is ignored or unavailable, and a custom MudLocalizer service implementation is registered. It attempts to use user-provided languages, falling back to the internal English translation if MudLocalizer is missing or no resource is found.