Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[Localization] Missing the case when default namespace is different from assembly name #2502
The document says:
In some cases, the default namespace is different from the assembly name. However, the document is missing for this case. The document should describe the available workaround for it. Or should clearly say "this is the limitation" if there's no workaround.
It goes on to say
That should be rewritten to:
If your targeted class does not use the same namespace you will need the full type name.**
@ryanbrandenburg is this correct?
@Rick-Anderson I don't think that's what @tanaka-takayoshi is saying. I think he's saying that although by default most people will have the default namespace be the same as their assembly name that's not always the case, the two can be different. The determining factor is the HostingEnvironement.ApplicationName which is also the AssemblyName as far as I know.
We should remove the references to default namespace in that section.
@dougbu does that all sound accurate to you?
I debugged something with reading [ResourceManagerStringLocalizerFactory] (https://github.com/aspnet/Localization/blob/dev/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs) and @Rick-Anderson 's comment appears good.
Then I tried two cases.
If the class name of resource, which is the T of
If the class name of resource doesn't start with the assembly name, we must specify the full class name in resource file name.
For one thing, there's no requirement that a C# namespace have any relationship to the assembly name. So mentioning the default namespace is somewhat off-topic except for the narrow case where users create classes in or below the default namespace and that default happens to be different from the assembly name e.g. because the assembly name contains special characters.