I need to get culture string from browser's language.
I thought about getting it from javascript like this:
var userLang = navigator.language || navigator.userLanguage;
but it gives me only first part of culture info that i would get from .NET:
Thread.CurrentThread.CurrentCulture.Name;
So javascript gives me "de" or "pl" instead of "de-DE" or "pl-PL" like in .NET. Is there a way to get the "full info" ?
Not really. The browser doesn't keep this detailed information in its DOM.
What you can do is, in your ASP.NET page, generate the
CultureInfo
in C#, like so: