Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Invalidate Translator cache when new translation files are added #28773

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

Closed
wants to merge 1 commit into from

Conversation

rpkamp
Copy link
Contributor

@rpkamp rpkamp commented Oct 8, 2018

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #27600
License MIT
Doc PR N/A

Just before writing the Translator cache, find out in which directories
the translation files were found, and add those directories as resources
for the catalogue so that when a new file appears in one of those
directories the catalogue cache will be invalidated.

This may cause some false positives in case non-translation files are in
those directories, but since the recommendation is to keep translations
on their own, it should not happen.

Just before writing the Translator cache, find out in which directories
the translation files were found, and add those directories as resources
for the catalogue so that when a new file appears in one of those
directories the catalogue cache will be invalidated.

This may cause some false positives in case non-translation files are in
those directories, but since the recommendation is to keep translations
on their own, it should not happen.
@rpkamp rpkamp force-pushed the translator-new-file branch from cc9aab5 to 9e68874 Compare October 8, 2018 19:00
@rpkamp
Copy link
Contributor Author

rpkamp commented Oct 8, 2018

Not 100% sure if I like the implementation, but it does work (tested in a real app).

Also, if anyone has an idea on how to write a test for this I'd like to hear it. From what I can see the caching part isn't under test at all?

@nicolas-grekas nicolas-grekas added this to the next milestone Oct 17, 2018
@rpkamp
Copy link
Contributor Author

rpkamp commented Oct 20, 2018

This approach was actually rather hacky and also incorrect because it assumed that new translation files would only be found in directories that current translation files were found in, which isn't necessarily the case; they might be added to other directories as well.

Therefore I've just opened a new PR that solves this problem correctly (#28937) and I'll close this one.

@rpkamp rpkamp closed this Oct 20, 2018
@rpkamp rpkamp deleted the translator-new-file branch October 20, 2018 20:58
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.2 Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants