Thursday, 1 March 2012

Localisation of built in MVC validation messages

While working on web site for a client in Belgium I was wondering why the Required attribute error message wasn’t being localised based on the CurrentUICulture of the thread.

This was bugging me, so I downloaded the MVC 3 source code from CodePlex and found the Required attribute unit test.  Even after changing the thread to use Flemish the below test still passed.

image 

After talking to Damian we found that there are Language Packs for .NET 4.  These can be obtained from http://www.microsoft.com/download/en/details.aspx?id=3324

These packs will install the required resources in you .Net 4 framework directory.
image

As soon as I installed the Dutch language pack the above test failed as expected.

image

I still need to test what gets stored in the logs when these packs are installed and an exception is thrown.  It won’t help us much if errors in the logs start getting stored in the language of the user that is logged in.

No comments:

Post a Comment