Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am developing a multi-language web application, for multi-language i have created a resource file for each language. the solution contains multi project (modals, main solution and solution), resource file is created in main project.

i want to do validation in model which is in another project in solution.

i can't add reference of resource file in model

What I have tried:

using 
[required(errormessage="vlaue required")]


here error message is hardcoded, which i want dynamic from resource-based on language
Posted
Updated 14-Feb-21 20:30pm

1 solution

Take a look here: Building a Multilingual Web Application Using .NET - Part Two[^]

C#
[Display(Name = "FirstName", ResourceType = typeof(Resource))]  
[Required(ErrorMessageResourceType = typeof(Resource), ErrorMessageResourceName = "FirstNameRequired")]  
public string FirstName { get; set; } 


More:
Globalization and localization in ASP.NET Core | Microsoft Docs[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900