Must use Type.FullName
for resource files found using default IStringLocalizer<T>
#2647
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Milestone
From @dougbu on Wednesday, October 19, 2016 7:46:53 PM
Behind our default

IStringLocalizer<T>
,ResourceManagerStringLocalizerFactory
removes a prefix matchingIHostingEnvironment.ApplicationName
orAssemblyName.Name
(in some cases) fromT
'sFullName
before a search of the containing assembly for requested resources. This does not help users who happen to have a different root namespace from the containing assembly / application name. They must useT
's entireFullName
e.g.One important case occurs when Visual Studio creates a new project from a template and the user chooses a name that's invalid as a C# identifier. The "safe project name" used as the root namespace is created using a simple algorithm but will not match the application / assembly name.
While redoing the "safe project name" algorithm in our code may be an ugly hack, we could e.g. extend
[ResourceLocation]
to also specify the namespace prefix to remove when searching for resources in the containing assembly based on aType
.Found while working with sample application at dougbu/Localized.1.1-preview. Screenshot above comes from VS with that solution open. (Took longer than it should for me to find the workaround.)
Copied from original issue: aspnet/Localization#296
The text was updated successfully, but these errors were encountered: