Closed (duplicate)
Project:
Drupal core
Version:
9.3.x-dev
Component:
system.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
9 Mar 2017 at 22:53 UTC
Updated:
25 Nov 2021 at 10:17 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
dbjpanda commentedFixed.
Comment #3
krina.addweb commented@dbjpanda,Thanks for the patch as i checked your patch manually by applying it in module file & it works well.
Comment #4
andypostLooks like duplicate of #2858062: $this->t() should be used instead of t() in Action classes
If someone willing to fix that - it should be total cleanup
Comment #5
dbjpanda commented@andypost the related issue which you have mentioned is of action module.Both the issue are for separate module. I could not get you what you want to convey.
Comment #6
andypostI mean each issue needs proper title to point its scope (module name I guess)
Comment #7
phenaproximaPatch looks good, re-titling for specificity.
Comment #8
manishmittal9 commentedbatch_test.callbacks is still affected
Comment #9
manishmittal9 commentedNew patch addressing #8
Comment #10
manishmittal9 commentedComment #11
manishmittal9 commentedAs referenced in comment #15 on https://www.drupal.org/node/2858062, this issue is now open for a mega-patch to apply to all the Core API's
Comment #15
suman.abc commentedI have changed
t()to$this->t()in file - core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/OptionsSelectWidget.php.Please check the attached patch. It is working fine.
Comment #19
nikitagupta commentedComment #20
nikitagupta commentedComment #22
nikitagupta commentedComment #24
cburschka- batch_test.callbacks.inc is procedural code; there is no
$this.- SystemInfoController does not use StringTranslationTrait, because it does not extend ControllerBase.
I'm sure there's a reason for not extending the base class (some other controllers in the namespace do, some others don't); I don't know if there's a reason not to use StringTranslationTrait directly.
Comment #25
cburschkaAdded StringTranslationTrait to SystemInfoController.
It looks like a reasonable change, but this may need some more review, because I don't understand the reason these controllers have for not extending ControllerBase.
Comment #27
cburschkaOne of the forms (SystemBrandingOffCanvasForm) extends PluginFormBase, which also does not extend FormBase or use StringTranslationTrait. This caused the test failures (which look a bit arcane because this is an AJAX form and only covered by Javascript tests).
(Also fixing a whitespace error that snuck into the patch.)
Note regarding test coverage: The earlier errors in SystemInfoController and batch_test.callbacks.inc didn't apparently cause any test failures.
Comment #28
nikitagupta commentedComment #29
tanubansal commentedTested #27, changes are visible in the code
Comment #32
vikashsoni commentedPatch applied successfully t() replaced with $this->t()
Thanks for the patch
Comment #33
quietone commentedThanks everyone for contributing to the improvement of Drupal.
It turns out that the fixes here were done in #3122912: t() calls should be avoided , use $this->t() instead in Form Builders. Although that is a later issue I am closing this as a duplicate and adding a parent issue.
Comment #34
quietone commented