AlexTeixeira/Askmethat-Aspnet-JsonLocalizer

Culture not processed correctly

ckotzbauer opened this issue · 2 comments

Hi,
I started using your nice library to overcome old resx structures ;). It is a .NET Core WebApplication where the translations should be returned for the current culture of the user. (Done with stringLocalizer.WithCulture(user.Culture)....

But unfortunately I always receive the translation for the default culture (German in my case). If I read your code correctly, WithCulture has no effect and for the initialization of the Localizer the CurrentUICulture is used, which I can't use. So it is currently not possible for me to get things right...

Are there any plans to change the culture behavior (and only fallback to CurrentUICulture if nothing is set)? Even if not, it would be great to add a note to the docs to avoid needless research in future ;)

Thanks!

Hi @code-chris,

Thanks for using the library :).

After some research, seems that WithCulture will be set Obsolete in version 3.0.0 ans removed in 4.0.0

Here some threads about this subject :

dotnet/aspnetcore#3324
dotnet/aspnetcore#3289
dotnet/aspnetcore#7756

In issues 7756 you have an example to overcome the WithCulture method.

I will add this info in the docs.

Thanks for noting this point.

Hi @AlexTeixeira,
thanks for your quick reply. That's not the most elegant solution 😉 but it works 👍.
Thanks for your research!