Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got languages by using Request Object but it retuns me an array list of languages which defined in my browser and I am not be able to understand which language of them that user uses in browser currently?
string[] userLang = Request.UserLanguages;

returns :
CSS
en-US
en;q=0.8
tr;q=0.6


For example currently I am using en;q=0.8
Posted
Comments
Michael_Davies 10-Sep-15 4:52am    
Though it is not C#, the article in the link is useful:

https://www.dyeager.org/2008/10/getting-browser-default-language-php.html
Ermany 10-Sep-15 5:13am    
Thank you so much. I am checking it If I can find anything to show my way in C#.

1 solution

It looks like the index 0 will be the current in use one: http://madskristensen.net/post/get-language-and-country-from-a-browser-in-aspnet[^]
 
Share this answer
 
Comments
Ermany 10-Sep-15 9:21am    
Thank you for your interest.But but index[0] of the language array doest retun current language. My default language Turkis but as show in your article string[] languages = HttpContext.Current.Request.UserLanguages;
returns :
User Language 0: en-US
User Language 1: en;q=0.8
User Language 2: cs;q=0.6
User Language 3: tr;q=0.4
User Language 4: af;q=0.2
User Language 5: hu;q=0.2
(I've added other languages for try)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900