aspnet-internationalization
aspnet-internationalization copied to clipboard
Validation messages are not localised
For instance 'Required' error messages
Putting this into my controller fixes it ([LanguageFilter] does not help)
protected override void Initialize(RequestContext requestContext)
{
var culture = requestContext.HttpContext.Request.Cookies["_culture"];
if (culture != null)
{
SetCulture(culture.Value);
}
base.Initialize(requestContext);
}
private void SetCulture(string culture)
{
culture = culture ?? "en";
ViewBag.Culture = culture;
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(culture);
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(culture);
}