There is not a single usage in core of the argument capability in either Yaml backed definitions, Annotation backed definitions or direct TranslationWrapper instantiation. In fact if the argument was actually dynamic wouldn't we have take of bubbling up some cacheability metadata. Reading the docs in TranslationWrapper:
* This class can be used to delay translating strings until the translation
* system is ready. This is useful for using translation in very low level
* subsystems like entity definition and stream wrappers.
I think we should completely remove support for arguments from that because support arguments at extremely low level is extremely risky. Obviously removing that support is followup material but not adding that support to YamlDiscovery is the concern of this issue.
I've classified this as a bug due to the lack of bubbling up some cacheability metadata.
Comment | File | Size | Author |
---|---|---|---|
#16 | 11-15-interdiff.txt | 7.04 KB | alexpott |
#15 | 2538514-15.patch | 3.06 KB | dawehner |
#11 | increment.txt | 989 bytes | pwolanin |
#11 | 2538514-11.patch | 9.82 KB | pwolanin |
#8 | 2538514-2.8.patch | 9.09 KB | alexpott |
Comments
Comment #1
alexpottLet's see what and if anything breaks.
Comment #2
pwolanin CreditAttribution: pwolanin as a volunteer and at Acquia commentedThis looks wrong - we have to have a way to provide arguments when the translation happens
Comment #3
dawehnerI always think its a bad argument to argument just with "It is not used in core". From an abstract point of view TranslationWrapper delays t(), this is all, so it should support what t() gives you.
In case we remove arguments support we should explicit explain why we don't want to support arguments.
Comment #4
pwolanin CreditAttribution: pwolanin as a volunteer and at Acquia commentedHere's a fix via pulling in some methods and tests from #2338081: Local Tasks, Actions, and Contextual links mark strings from derivatives (or alter hooks) as safe and translated
Marking critical since it's blocking the other critical issue - it doesn't make sense to proceed there without this done first (imho)
Comment #5
dawehnerAs written before we should document why we not support arguments
mixed[] would be fair I guess?
this should be not longer needed
can be dropped as well
Comment #6
pwolanin CreditAttribution: pwolanin as a volunteer and at Acquia commentedok, let's kill it.
Comment #7
alexpottI discussed this with @xjm, @catch, @effulgentsia and @webchick and we felt that this was not critical as it is okay that yaml plugin discovery loses argument support in #2338081: Local Tasks, Actions, and Contextual links mark strings from derivatives (or alter hooks) as safe and translated but annotation based discovery still has it. And this issue does not block the critical. We agreed that the cacheability concerns probably mean that this is a major.
Comment #8
alexpottNo harm in adding a test :)
Comment #9
pwolanin CreditAttribution: pwolanin as a volunteer and at Acquia commentedAs long as the discussion already inckuded @effulgentsia, I think this is ready.
Comment #10
dawehnerDoes someone mind removing those lines as well?
Comment #11
pwolanin CreditAttribution: pwolanin as a volunteer and at Acquia commentedlike so?
Comment #12
dawehnerThank you
Comment #13
alexpottTranslationWrapper's are how we avoid caching all plugin definitions by language - @dawehner has pointed out that we break this in ViewsEntityRow:
I think we should dial this issue back to just removing argument support from annotation defined plugins and address TranslationWrapper and ViewsEntityRow in yet another issue.
Comment #14
dawehnerI try to do just that change.
Comment #15
dawehnerThere we go.
Comment #16
alexpottMy version of #15 was identical. Attaching an interdiff to #11.
Comment #17
dawehnerchange title and add the views followop.
Comment #18
Gábor HojtsyRe the original goal of this issue, if the arguments may be dynamic and need their cache tags, so is the target language of the translations (via $options), so you would need to remove support of that too if you want predictable output based on global cache tags without the need for cache tag bubbling. At that point, the argument would be an empty or a single item array, so no need for it to be an array, so both the list of arguments and the number of them and type of them would be different between TranslationWrapper and t(), which I am not sure qualifies TranslationWrapper to be named as it is? At least someone in contrib would need to come up with an ActualTranslationWrapper that allows those options (and somehow bubbles cache info) then. Also the plan to change the signature would have required potx changes.
The newly proposed patch (totally different direction I see) may also need a sister issue in potx to adjust the parsing of the annotation.
Comment #19
Gábor HojtsyAdding a whole bunch of tags. Given this is not required for release, and we are post API-freeze (by over two years :D), it would be good to summarize the impact / disruption like any other major API change. Also will need a change record once its settled.
Comment #20
pwolanin CreditAttribution: pwolanin as a volunteer and at Acquia commentedSince this is just about annotation processing, is it really an API change?
Comment #21
Gábor HojtsyLooks like there is a lack of interest to prioritize this, so removing from sprint accordingly.
Comment #22
dawehnerWith #2557113: Make t() return a TranslationWrapper object to remove reliance on a static, unpredictable safe list being critical this probably won't fly anyway :)