Class Localizer
Provides localized string resources for an application.
Inheritance
Implements
Inherited Members
Namespace: DataWeb.Localization
Assembly: DataWeb.Core.dll
Syntax
public class Localizer : IStringLocalizer
Constructors
Localizer(ILocalizationService, IServiceProvider)
Initializes a new instance of the Localizer class.
Declaration
public Localizer(ILocalizationService localizationService, IServiceProvider serviceProvider)
Parameters
Type | Name | Description |
---|---|---|
ILocalizationService | localizationService | The ILocalizationService implementation to use. |
IServiceProvider | serviceProvider | The System.IServiceProvider instance to use for resolving services. |
Fields
Culture
Declaration
public CultureInfo Culture
Field Value
Type | Description |
---|---|
CultureInfo |
Properties
this[string, object[]]
Gets the localized string for the specified name and formats it with the specified arguments.
Declaration
public LocalizedString this[string name, params object[] arguments] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the resource. |
object[] | arguments | The arguments to format the string. |
Property Value
Type |
---|
LocalizedString |
this[string]
Gets the localized string for the specified name.
Declaration
public LocalizedString this[string name] { get; }
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the resource. |
Property Value
Type |
---|
LocalizedString |
Methods
GetAllStrings(bool)
Gets all the localized strings for this localizer instance.
Declaration
public IEnumerable<LocalizedString> GetAllStrings(bool includeParentCultures)
Parameters
Type | Name | Description |
---|---|---|
bool | includeParentCultures | True to include localized strings from parent cultures, false otherwise. |
Returns
Type | Description |
---|---|
IEnumerable<LocalizedString> | All the localized strings for this localizer instance. |
WithCulture(CultureInfo)
Gets a new localizer instance with the specified culture.
Declaration
public IStringLocalizer WithCulture(CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
CultureInfo | culture | The culture for the new localizer instance. |
Returns
Type | Description |
---|---|
IStringLocalizer | A new localizer instance with the specified culture. |