-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
The PortableObjectStringLocalizerFactory
which is responsible for calculating the msgctxt
has a bug, where the project name is removed. This works fine in the Orchard CMS codebase, because the projects/areas are nested in a specific way, but breaks for generic projects.
Orchard Core version
latest, 2.1.7, probably others as well
To Reproduce
- Clone a simple demo project that uses the PO localization: e.g.: https://github.com/skyflyer/DotnetPoLocalizationDemo
- Add the project name before the
Views
in the msgctxt in the localization file - Run the project
- See that the string is not localized, because the calculated
msgctxt
for the translation is without the project name
Expected behavior
The msgctx
should include the project name.
Discussion
At first, I thought that the issue is with the PO Extractor tool, but after some tinkering and thinking about it, I believe the tools works correctly and that the PortableObjectStringLocalizerFactory
is incorrectly calculating the context. This, interestingly, works correctly in the Orchard CMS codebase, because of how the projects are nested.
There is some more analysis in the PR which I filed for PO Extractor tool (which I believe is the wrong fix for this issue, as that would also break the Orchard CMS localization).