Skip to content

Localization: Some ResourceManager classes now require ILogger in constructor #260

Open
@ryanbrandenburg

Description

@ryanbrandenburg

Summary
For the 2.0.0 release ResourceManagerWithCultureStringLocalizer, and ResourceManagerStringLocalizer require an ILogger parameter on their constructors and ResourceManagerStringLocalizerFactory requires an ILoggerFactory. Neither of these parameters may be null.

As is usual with our announcements, this thread is locked to avoid spamming users subscribed to aspnet/Home. Use aspnet/Localization#258 for discussion and questions.

Impact
Users who use Localization through .AddLocalization and .AddViewLocalization and so on won't be affected, and we think that accounts for most users. Users who construct any of these classes in their own code, subclass them etc. will have to update their code to include passing an ILogger or ILoggerFactory. The easiest way to do that would be through dependency injection:

context.HttpContext.RequestServices.GetRequiredService<ILoggerFactory>();

but users who do not care to receive Logging information and want a quick integration might also use NullLoggerFactory.Instance.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions