I am developing one MVC4 application in which there is an option to select the language in my application and, based on the selected lanaguage, all labels and messages are displayed. In this application, I placed one required check of the MVC field, and this will display the check message in English only. I created two different xml files for localization in my application folder, i.e. Resource.resx for English lanaguage and Resource.de-DE.resx for German langauge. I used the following code in the Model class:
[Required(ErrorMessageResourceType = (typeof(MyFolder.MyResource.Resource)), ErrorMessageResourceName= "FromDateRequiredMessage")] [Display(Name = "FromDate", ResourceType = typeof(MyFolder.MyResource.Resource))] public DateTime FromDate { get; set; }
So, I have a Resource.resx xml file, and in it I have "FromDateRequiredMessage", which is the same key as in the Resource.de-DE.resx file, but has a different meaning. I also made changes to my web.config file for globalization:
<globalization enableClientBasedCulture="true" culture="auto" uiCulture="auto"/>
So, I want that when choosing German from my application, it should show me a verification error in German. But here he will show me confirmation only in English.
So what can I do for this? Please help me.
source share