Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Sutharsan’s picture

First attempt.

I've used this bash command to check for remaining t() usage:

find core -name Block -print | xargs grep -r "[^a-z|^>]t("
Sutharsan’s picture

Status: Active » Needs review
FileSize
613.71 KB

I continued with the script above and made a conversion script for ALL plugins changing all t() to $this->t():

find core | grep -v Derivative | grep -v FieldType | grep -v BlockManager\.php | grep \/Plugin\/[^/]*\/.*\.php | xargs sed -Ei .bak 's_([^a-z|^>])t\(_\1$this->t(_g'
find core -name *.bak -exec rm {} \;

Notice that the script skips the Derivative and FieldType plugins, and BlockManager. They don't implement a t() method yet.

Resulting patch is attached.

robertdbailey’s picture

Status: Needs review » Needs work

The last submitted patch, 2: drupal-plugin-block-t-2223435-2.patch, failed testing.

Xano’s picture

Status: Needs work » Needs review
FileSize
14.35 KB

Re-roll.

dawehner queued 5: drupal_2223435_5.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 5: drupal_2223435_5.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
17.69 KB

Rerolled from scratch.

Xano queued 8: 2223435-block-t-8.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 8: 2223435-block-t-8.patch, failed testing.

Xano’s picture

Status: Needs work » Needs review
FileSize
17.94 KB

Re-roll.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

It is green, let's get it in

alexpott’s picture

Category: Task » Bug report
Status: Reviewed & tested by the community » Fixed

Changing t() to $this->t() is a no op change and as far as possible we should not be using procedural functions in OO code. I consider this a bug. Committed a120969 and pushed to 8.0.x. Thanks!

  • alexpott committed a120969 on 8.0.x
    Issue #2223435 by Sutharsan, Xano, tim.plunkett: Do not use t() in block...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.