Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Localization For Models in Domain Classes & VIews From ResourceLibarary

$
0
0

Hi,
This My Solution ,

now i can just define my fildes(text to translate) models,views and ....  in ShareResource.resx .

how to set localization for models & Views for seprate layer (Domain Classes) from resource libarary ? 

i want define text localization in resource library but in seperate folder not all define in shareResource.resx, for example : 

RecourceLibaray/Resources/Views/Home/Index.en.resx

 ............................................

StartUp.cs

  services.AddLocalization(options => options.ResourcesPath = "Resources");
            services.AddControllersWithViews().AddViewLocalization(LanguageViewLocationExpanderFormat.Suffix
           ) .AddDataAnnotationsLocalization(options=>
               options.DataAnnotationLocalizerProvider = (type, factory) =>
                        factory.Create(typeof(SharedResource))
                );

News.cs 

publicclassNews{[Required(ErrorMessage="{0} is required")][Display(Name="Title")]publicstringTitle{get;set;}}

News.fa.resx




Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>