Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Preferred Culture Info / Language - C#, ASP.NET

I am trying to get the users preferred language. I see all kinds of articles on how to set it, but they assume that the user is telling it which language to select (like in a dropdownlist).

In Firefox under Tools > Options > Content > Languages > Choose you can select which languages you prefer and choose their order. I want to be able to access that list, or at least the preferred language in the C# codebehind. How do I go about this? Is this possible?

Everything I have tried always returns en-US, no matter whats in the list.

like image 717
Jason Avatar asked Jul 01 '10 22:07

Jason


1 Answers

I believe what your after is this

Request.UserLanguages

From the documentation

"Gets a sorted string array of client languages preferences.

like image 82
Razor Avatar answered Sep 21 '22 12:09

Razor