Here is my example (did cost me a few hours pf my life to figure out what's going on):
I did set this line services.AddLocalization(options => options.ResourcesPath = "Resources");
And then, this works:
services.AddMvc()
.AddDataAnnotationsLocalization(options =>
{
options.DataAnnotationLocalizerProvider = (type, factory) =>
{
var assemblyName = new AssemblyName(typeof(DataAnnotations).GetTypeInfo().Assembly.FullName);
return factory.Create("DataAnnotations", assemblyName.Name);
};
});
This does not work:
services.AddMvc()
.AddDataAnnotationsLocalization(options =>
{
options.DataAnnotationLocalizerProvider = (type, factory) =>
factory.Create(typeof(DataAnnotations));
});
The latter scenario will work though, if you remove the ResourcesPath. This should be clearly stated on the documentation as it is very confusing at the moment.
Originally posted by @vocko in #16964 (comment)
Associated WorkItem - 560724
Here is my example (did cost me a few hours pf my life to figure out what's going on):
I did set this line
services.AddLocalization(options => options.ResourcesPath = "Resources");And then, this works:
This does not work:
The latter scenario will work though, if you remove the ResourcesPath. This should be clearly stated on the documentation as it is very confusing at the moment.
Originally posted by @vocko in #16964 (comment)
Associated WorkItem - 560724