Thre's a number of post on StackOverflow as well as other sites around this topic. I was however having hard time finding anything related to MVC3 and it's specific resource keys.
In order to globally localize generic MVC messages one should:
- Create a resource file under App_GlobalResources folder
- set DefaultModelBinder.ResourceClassKey to the resource name (without .resx)
- Create localized copies of MvcResources.resx under that folder and resource name
I've tested this and according to MSDN, if I set the ResourceClassKey to something non existent it should throw exception. It doesn't happen so I must be doing something wrong.
If anyone has got this working under MVC3 and Razor, here's the questions:
- where to find the correct MvcResources.resx for MVC3? I was only able to find one for version 2
- Where should one set the DefaultModelBinder.ResourceClassKey property? Would that be under Global.asax -> Application_Start or for each request?
Any ideas greatly appreciated.