jgauffin/griffin.mvccontrib

Localizing text for ModelState.AddModelError()

Opened this issue · 0 comments

I am working with your localization solution in MVC4, and I am currently in the process of refactoring the stock AccountController so it is localized. However, I ran into a snag - much of the logic is not using DataAnnotations Attributes, but instead is running server-side code and then calling ModelState.AddModelError() directly. I can think of many other cases where using DataAnnotations Attributes are not appropriate.

Is there a way to localize ModelState.AddModelError() using your solution, is there a workaround you have worked out, or is this functionality not included in the box?

NOTE: I am also using the CSLA framework for my models, which support DataAnnotations, but there are more features available in the CSLA framework that DataAnnotations don't support (validation rules that apply to the model itself, validation rules that apply to more than one property, warning priority instead of error, etc.) Therefore, one way or another I need a fix for localizing the text for messages that are added directly using ModelState.AddModelError().