I want to localize Web Service in ASP.NET application.
I can write the following code to detect preferred client culture:
CultureInfo culture = null;
if (Request.UserLanguages!=null && Request.UserLanguages.Length>0) {
string lang = Request.UserLanguages[0];
if (!String.IsNullOrEmpty(lang)) {
try {
culture = new CultureInfo(lang) ;
}
catch {}
}
}
And use this expression to get string from resources:
WebResources.ResourceManager.GetString(stringName, culture);
But I want to use something similar to Page directive attributes:
Culture="Auto" UICulture="Auto"
Is it possible?