ASP.NET MVC has default facility for DATA ANNOTATION to provide validation. If you want to set your validation message as localization means when culture change, your validation message text change as per culture. You can also change label text with the change of culture. Let’s see step by step.
Here, we set two culture conversion ENGLISH and GERMAN
Here, we set two culture conversion ENGLISH and GERMAN
1. Add Resource.resx (For English ) and Resource.de.resx (For German)
--> Project properties Folder and AddNewItem Add Resource.resx (For English)
--> Project properties Folder and AddNewItem Add Resource.resx (For English)
--> Same as Add Resource.de.resx (For German)
--> Make sure to change the Access Modifier to Public (default is Internal)
2. Install-Package ModelMetadataExtensions
3. In model file sets error message and label
-->ErrorMessageResourceType sets type created by build provider. I added WebApplication.Properties.
-->ErrorMessageResourceName sets from resource file
-->For display label sets label name from resource file.
-->ErrorMessageResourceName sets from resource file
-->For display label sets label name from resource file.
4. Sets Global.asax file for URL routing.
5. Sets controller like
6. When runs with English culture
7. When runs with German culture
Happy programing friends.