core
core copied to clipboard
Localization issue when moving from websharper 3.6 to 4.5
Moving here from http://forums.websharper.com/topic/86318
As we discussed in https://forums.websharper.com/topic/86294#86298#86298 topic, there is a problem with standard dotnet localization. I've been used localizable resources and in WebSharper 3.6 the culture has been chosen automatically from http request. In 4.5, I have to call code like this:
ctx.Request.ServerVariables.["HTTP_ACCEPT_LANGUAGE"] |> Option.map (fun s -> s.Split(',') |> Array.map (fun s -> s.Split(';').[0])) |> Option.bind Array.tryHead |> Option.iter (fun culture -> Thread.CurrentThread.CurrentUICulture <- CultureInfo.GetCultureInfo culture)in Sitelet.Infer to make it work. Not so big deal, but previous functionality was better.
This is also very probably a change introduced when adding ASP.NET Core compatibility to WebSharper, some ASP.NET 4x behavior also seems to be affected.