Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ryanbrandenburg opened this issue Sep 27, 2019 · 2 comments · Fixed by #15044
Assignees
Labels
breaking-change Indicates a .NET Core breaking change

Comments

@ryanbrandenburg
Copy link

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
@joshfriend
Copy link

After upgrading to .net core 3.0 IStringLocalizer.WithCulture no longer works at all. I always get english strings returned now.

I've tried using CultureInfo.CurrentUICulture as suggested, but this doesn't work either.

@joshfriend
Copy link

Oh, it's because SharedResource stuff is broken since 3.0 dotnet/sdk#4033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants