Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

.Net Core Localization

$
0
0

Hi,

In my .NET Core Controller, I'd like to set localization to the value preferred by the client's browser. So, for example, if my #1 language/Culture preference is en-CA (English Canada), I'd like my web server to automatically reflect that.

In prior versions of .Net, this was accomplished via something like the following:

System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

How is that handled in .Net Core?

I'm familiar with https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization but do not understand how to set the CurrentCulture based on the browser setting.

We are using VS 2017, Windows 10, .Net Core 1.04. 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>