Is there a way to set the culture of error messages coming back from SS via the incoming request from the Client? Can I set the culture of a JSONService client in some fashion and then have SS respond with message text in that culture.
Yes, you can set the current culture per request in a pre-request filter:
host.PreRequestFilters.Add((httpReq, httpResp) =>
{
Thread.CurrentThread.CurrentUICulture = DefaultCulture;
if (httpReq.Headers.AllKeys.Contains(HttpHeaderKeys.AcceptLanguage))
{
var cinfo = new CultureInfo(httpReq.Headers[HttpHeaderKeys.AcceptLanguage]);
if (new ResourceManager(typeof(ResourceFile)).GetResourceSet(cinfo, false, false) != null)
Thread.CurrentThread.CurrentUICulture = cinfo;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With