Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The t() documentation says:
When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t()
The documentation for the Drupal\Core\Render\Element
is using $this->t
in an inconsistent way.
There are places where t() is used. In other places $this->t() is used.
Also there are are some strings that should be translatable and they are not wrapped into t().
Proposed resolution
Replace all the t() with $this->t() in the Drupal\Core\Render\Element
.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#4 | interdiff-2709411-2-4.txt | 2.95 KB | dagmar |
#4 | replace-t-docs-2709411-4.patch | 15.78 KB | dagmar |
#2 | replace-t-docs-2709411-2.patch | 15.77 KB | dagmar |
Comments
Comment #2
dagmarHere is the patch.
Comment #3
jhodgdonThanks! I think this patch is a good idea.
It needs an update though -- in several places, you did
instead of
In other words, the "t" in the t() method call got left out by mistake. Whoops!
I found several places where this occurred, but other than that the patch looks great:
missing t
same here, missing t
missing t
both of these are missing the t
more missing t
missing t
Comment #4
dagmarSorry! I did a bad search & replace. Here is the new patch.
Comment #5
jhodgdonLooks good, thanks!
Comment #6
alexpottCommitted 72cca02 and pushed to 8.1.x and 8.2.x. Thanks!
I committed this to 8.1.x as well because it is a docs fix only.