I'm struggling with JQuery Validation Unobstrousive, which is already built in with creating an ASP.Net MVC 5 Project.
Locally my whole machine is in a german environment. The validation text of JQuery Validation is coming from my data annotations:
[MaxLength(2000)]
public string Beschreibung { get; set; }
Debugging my project locally show the validation messages in german language. After deploying on the server the validation messages are changed to english language.
I searched on the Internet and found several possible solutions, but no one was working for me:
- loading german localization file after validation-js-files
- setting in html-tag: lang="de-de"
- setting in web.config: globalization culture="de-DE" uiCulture="de-DE"
- setting in Global.asax.cs:
.
protected void Application_BeginRequest(object sender, EventArgs e)
{
CultureInfo culture = new CultureInfo("de-DE");
Thread.CurrentThread.CurrentCulture = culture;
Thread.CurrentThread.CurrentUICulture = culture;
}
When checking the CultureInfo
in the view (
<h2>@System.Threading.Thread.CurrentThread.CurrentCulture</h2>
<h2>@System.Threading.Thread.CurrentThread.CurrentUICulture</h2>
), it's always showing correctly "de-DE", but all validation messages are still english.
Can anybody help me? I want to change the language from english to the existing german language.