-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Recompile container when translations directory changes #32708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7a0fe22
to
7f2e7e2
Compare
This partly reverts #28937 /cc @rpkamp |
Well, #28937 passed the scanned directories to the translator cache. But it won't automatically bring in the new resource files if the container itself is not rebuilt. So this revert is indeed necessary. |
New files within previously known directories should be fine. It seems to me the problem is newly added directories (like a new bundle, or a new directory added to the It looks like #27600 is still solved with this PR ( |
@rpkamp this PR still does not rebuild the container when you change a file. What we need based on the responsibility of each:
Symfony 4.2 and older were doing 1 and 3 properly, but failing on 2. #28937 is adding the support for 2, but is breaking 1 (as it never rebuilds the container cache for such things). This PR is reintroducing 1 partially (it detects when you add or remove a translation folder, due to adding a bundle for instance, but not when you add a file in an existing folder, due to adding a new locale or catalogue in this folder). |
As far as I can tell it does, because all directories that contain translation files are marked as DirectoryResource in the container, which are considered non fresh when the mtime changes, and that changes when the mtime of one of the files within that directory changes. Which is fine, correctness over performance and all that, but it would be nice if we could have our cake and eat it to 🍰 |
One option around the issue is to deprecate the behaviour of caching the list of resources in the container and only passing the directories so that the translator is fully independent of the container cache. I created a POC at #32735 to discuss this option, but for now, this PR solves the other issues mentioned. |
Thank you @pierredup. |
…ierredup) This PR was merged into the 4.3 branch. Discussion ---------- Recompile container when translations directory changes | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #32706 | License | MIT | Doc PR | N/A The list of translation resources is cached by the container, so when adding a new translation file, the container needs to be recompiled otherwise the translator won't know about the new file. Commits ------- 7f2e7e2 Recompile container when translations directory changes
The list of translation resources is cached by the container, so when adding a new translation file, the container needs to be recompiled otherwise the translator won't know about the new file.