Class ErrorLocalizer
The default IErrorLocalizer. For each culture from the wanted one up to its neutral parent (ar-EG →
ar) it asks every IErrorMessageSource in order (the app's first, so apps can override package texts); then the
sources' neutral (English) text; then Message. Named placeholders ({Field}) are filled from
Arguments, formatted for the wanted culture; unknown ones stay as written.
Implements
Inherited Members
Namespace: ZhEaIsNsAaBn.Utilities
Assembly: ZhEaIsNsAaBn.LayerResponse.dll
Syntax
public sealed class ErrorLocalizer : IErrorLocalizer
Remarks
Transitional: while error catalogs still carry MessageAR, it is used as the ar text when no source
has one.
Constructors
ErrorLocalizer(IEnumerable<IErrorMessageSource>)
Creates the localizer.
Declaration
public ErrorLocalizer(IEnumerable<IErrorMessageSource> sources)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IErrorMessageSource> | sources | The message sources, highest priority first. May be empty. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Fields
NeutralLocale
The language of neutral resources and of Message.
Declaration
public const string NeutralLocale = "en"
Field Value
| Type | Description |
|---|---|
| string |
Methods
Localize(Error)
The message in CurrentUICulture (set per request by request localization).
Declaration
public LocalizedMessage Localize(Error error)
Parameters
| Type | Name | Description |
|---|---|---|
| Error | error | The error. |
Returns
| Type | Description |
|---|---|
| LocalizedMessage | The message and the locale it is really in. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Localize(Error, CultureInfo)
The message in culture, falling back to its parent cultures, then English.
Declaration
public LocalizedMessage Localize(Error error, CultureInfo culture)
Parameters
| Type | Name | Description |
|---|---|---|
| Error | error | The error. |
| CultureInfo | culture | The wanted culture, e.g. |
Returns
| Type | Description |
|---|---|
| LocalizedMessage | The message and the locale it is really in. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|