-
Notifications
You must be signed in to change notification settings - Fork 65
Resource name is incorrect when not setting Options.ResourcesPath #138
Comments
Nice catch @DamianEdwards |
@DamianEdwards it appears that the current behavior when there's no ResourcePath is to find the resource in the root of the project, I assume we're OK loosing that functionality? |
No it doesn't. It ends up looking for a resource named "MyApplication..MyApplication.Full.TypeName". It's impossible to create a resource with that name, and the resource creation is non-configurable; it just gets named based on the name and path of the resx file in the project. |
@DamianEdwards that's my bad, for some reason my VS was running an old version of a project when I had saved changes to it which got me confused. |
Turns out we didn't catch the other case that needs to be updated to: https://github.com/aspnet/Localization/blob/dev/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs#L98 |
@DamianEdwards it looks like that case is taken care of by the "rootPath = location ?? _applicationEnvironment" above, right? The functional tests actually exercise this function and seem to get an acceptable baseName. |
Yeah you're right. |
- Cleaned up code a little to make it easier to understand (maybe) - #138
- Cleaned up code a little to make it easier to understand (maybe) - #138
See the line at https://github.com/aspnet/Localization/blob/dev/src/Microsoft.Extensions.Localization/ResourceManagerStringLocalizerFactory.cs#L68
If
RequestLocalizationOptions.ResourcesPath
is not set (the default) then this will effectively cause the application name to be appended to the beginning of the full type name, thus making it impossible to actually resolve that resource.This means you can't just create a resx file next to a class' cs file with the same name and have it work, e.g.
HomeController.cs
andHomeController.en-AU.resx
The line should probably be something like:
The text was updated successfully, but these errors were encountered: