12

I am using ASP.NET MVC 4 with unobtrusive clientside validation. The language in my application is german (defined in the web.config file)

If i have a required field (configured with data-annotations in my Code First Classes), the client side validation works fine. the only downside: The Message is not Localized.

The Field XXXX is required.

Is there a solution out for this problem?

2 Answers 2

17

You must install the .NET Framework Language pack, according to your .NET Framework version:

Microsoft .NET Framework 4.5 Language Pack: http://www.microsoft.com/de-de/download/details.aspx?id=30667

Microsoft .NET Framework 4 Full Language Pack: http://www.microsoft.com/de-de/download/details.aspx?id=23067

In these pages, check the requirements, in order to see if they meets your needs (i.e.: Operating System Version, x86 or x64, etc.). If they don't meet your needs, search on Google something like "Microsoft .NET Framework German Language Pack".

Sign up to request clarification or add additional context in comments.

7 Comments

i've tried the links. my system tells me, that the language pack is already part of the system-installation -> seems that i have it already installed, but the error messages are still in english...
Do you have, in your Web.config, something like this: <globalization culture="de-DE" uiCulture="de-DE" ..... /> ?
Try uninstall the language pack you have in your system and then install the new one.
There is no explicit language pack installed on my system (win 8), and the error message is (translated): `Microsoft .NET 4.5 is already installed' (seems that the LanguagePack is always installed?)
|
3

Yes - reference your resource file in your validation attributes:

[Required(ErrorMesageResourceName="LastName", ErrorMessageResourceType=typeof(YourResourceClassName))]

4 Comments

The downside with annotating the ressourceName is, that you have to do it for EVERY Property, and i have lots of them... (beside from that - there have to be a smarter solution!? because the information is already there when i annotate [Required], only the translation is missing)
Yes, it is an issue adding resource file references to every property but when you want a different language it's very simple - just drop in another resource file.
Also, you'll find that relying on the default messages (even in German) is too limited for anything but the most simple website. So even if you get the language pack sorted I'd still go for resource files.
It seems that there is an issue with Windows 8 and the language pack, this may help - support.microsoft.com/kb/2738065

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.