Skip to content

ResourceManagerWithCultureStringLocalizer class and WithCulture interface member marked Obsolete and will be removed #14753

Closed
@ryanbrandenburg

Description

@ryanbrandenburg

ResourceManagerWithCultureStringLocalizer class and WithCulture interface member marked Obsolete and will be removed

The ResourceManagerWithCultureStringLocalizer class and WithCulture interface member are often sources of confusion for users of Localization, especially if they want to create their own IStringLocalizer implementation. These items give the user the impression that we expect an IStringLocalizer instance to be "per-language, per-resource", when actually they should only be "per-resource", with the language searched for determined by the CultureInfo.CurrentUICulture at execution time. To remove this source of confusion and to avoid APIs which we don't want users to use we will be obsoleting these in 3.0.0-preview3, and they will be removed in a future release (4.0 or above).

For context, see here.

See dotnet/aspnetcore#7756 for discussion.

Version introduced

3.0

Old behavior

Methods were not Obsolete.

New behavior

Methods are marked Obsolete.

Reason for change

API represented a use case which is not recommended, and leads to confusion about the design of Localization.

Recommended action

If you are using this we recommend that you use ResourceManagerStringLocalizer instead, and let the culture be set by the CurrentCulture. If that is not an option You may create a copy of ResourceManagerWithCultureStringLocalizer in your own repo and use that.

Category

  • ASP.NET Core

Affected APIs


Issue metadata

  • Issue type: breaking-change

Metadata

Metadata

Assignees

Labels

breaking-changeIndicates a .NET Core breaking change

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions