There may be an alternate API for injected translations based on how #2018411: Figure out a nice DX when working with injected translation figures this out. Should support that too.

CommentFileSizeAuthor
#7 potx-d8_t.patch1.2 KBherom
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

Version: 7.x-2.x-dev » 6.x-3.x-dev
Gábor Hojtsy’s picture

Status: Active » Postponed

#2018411: Figure out a nice DX when working with injected translation is not yet decided, so I don't think we can do anything here yet.

Gábor Hojtsy’s picture

Title: Support for Drupal 8 injected translations » Support for Drupal 8 $this->t()
Status: Postponed » Active

#2018411-34: Figure out a nice DX when working with injected translation says it is settled on $this->t(), that is what should be supported. This is an alter-ego of t() from the POV of potx. Any $this->t() should be parsed as t().

herom’s picture

I guess this was never an issue. Because from the point of view of tokens, the "t" in $this->t is no different from just calling "t"; they are bost T_STRING.
I have confirmed this by checking for some strings manually.

Gábor Hojtsy’s picture

Wow, it just works? Wow!

Gábor Hojtsy’s picture

Status: Active » Needs work
Issue tags: +Needs tests

Can we add test coverage to prove/ensure it works? :)

herom’s picture

Status: Needs work » Needs review
FileSize
1.2 KB

something like this?

Gábor Hojtsy’s picture

Version: 6.x-3.x-dev » 7.x-2.x-dev
Status: Needs review » Patch (to be ported)

Yay, committed that to 6.x-3.x. Needs to be ported to 7. Thanks a lot!

YesCT’s picture

Maybe a tiny related.

  • Gábor Hojtsy committed 45293fd on 7.x-2.x
    Issue #2019679 by herom | Gábor Hojtsy: Add tests about existing support...

  • Gábor Hojtsy committed 45293fd on 7.x-3.x
    Issue #2019679 by herom | Gábor Hojtsy: Add tests about existing support...
SebCorbin’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Patch (to be ported) » Closed (fixed)

Ported to 7.x-3.x as it has been branched directly from 6.x-3.x