Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swap English to Spanish in ValidationMessageFor Method Dynamicaly

My Models / data silos are in a different class library which contain data annotation - Required, Max Length and some custom validation. This all works great in English however is there a way to swap the English validation message for the Spanish using a global resource file contained in the web project. The class library is used both on the web site and other components so I cannot be assured that the resource file will be in the same project.

like image 704
Ian Benoliel Avatar asked Nov 30 '25 21:11

Ian Benoliel


1 Answers

Assuming you are talking about a .Net MVC application, I suggest you have a look at this blog post about internationalization in MVC3:

http://afana.me/post/aspnet-mvc-internationalization.aspx

For a project I am currently working on, we decided to place the resource-files in a separate project, so that we could keep all the resource-strings in one place, and then simply referring to the language-project from any other project that needs multi-lingual support.

like image 186
Christofer Eliasson Avatar answered Dec 03 '25 10:12

Christofer Eliasson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!