[translation][performances] move loading resources into Translator initialize. #13897
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[translation] fixed loading resources performances.20f7d11There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the argument in the middle of the list can become an issue for people extending this class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed.
3ebfd7ato3e8bd20CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
répertoire:)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense ;)
3e8bd20todfdbc04Compare[translation][loading resources] added test.5c2d1eddfdbc04to5c2d1edCompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing the resource directories, what about passing the list of files and move back this piece of code in the extension? That would make things faster and safe as if the list of files changes, the container is going to be rebuilt anyway.
[translation] load resources per locale.7be239fThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
ifis not needed anymore.[translation][loading resources] added Fallback Locales.9a1d6d9Thank you @aitboudad.
027a747minor #14011 [Translation][debug mode] refresh cache when resources i…e99c09eminor #14022 [Translation] keep old array structure of resourcesFiles…2f39901This defers adding the resources until
initializeCatalogueis called. That means that at the time the cache path is determined the resources will still be uninitialized.I haven't checked, but I think this re-introduces the bug fixed for the
Components/Translation/Translatorin #13074 back into theFrameworkBundle/Translator/Translator.@aitboudad Could you please check if this PR makes the resource initialization so late that we use wrong or even multiple cache file paths for a given locale and resource set?
That would re-introduce a bug already fixed. I don't know if that should be before 2.7 is released? (/cc @fabpot)
Looks like something we might do before 2.7... which will be released in less than 2 weeks from now.
@mpdude ok I'll check it and thanks for reporting this.
@mpdude
the only way to solve the issue is to revert #14281, is it ok for you ?sorry I think you missed this fix Translator.php#L68-L70
Not sure if #14281 is the right thing to revert. The change that (IMO) causes the problem is the optimization made in this PR here.
In #14011 (the fix you mentioned above), you basically reverted the optimization for
kernel.debugmode.Still, when you're using two different instances of
FrameworkBundle/.../Translatorthey will mess up each other's cache file because both determine the cache file name before any resources are added.Well I couldn't find the right solution, I'd prefer using the old name of catalogue without catalogueHash at least in the prod env.
right ?
Well you have
$this->resourceFiles, can't you just use that (plus the locale) to derive the cache file name?@mpdude I'd prefer the safe way as I see some bundles add resources until initializeCatalogue is called see LiipTranslationBundle for example.
fixed by #14725