We are trying to implement localization for our domain models that exist in a separate class library project in our solution. However, we cannot make it work, since the annotation attributes of these models are not translated at all.
Project structure
- Decision
- Web project
- Resource folder (contains .resx. Ex. App.en.resx files) Works fine
- Class library
- Domain Models
- Resource folder (contains .resx. Ex. App.en.resx files) Doesn't work
Startup.cs
services.AddMvc() .AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix) .AddDataAnnotationsLocalization();
Note
Localization works as part of a web project, for example, translates views, controllers. However, this does not work when we try to translate models that exist in a separate project.
//Yours faithfully
source share