The generated placeholder for complex tokens in {% trans %} tags just got updated in #2280955: Fix TwigTransTest.
Now it includes the full token, not just the last part after the dot.

Comments

gábor hojtsy’s picture

Erm, is that the new string structure used by twig then? Why was "token." added? What other things are possible there?

herom’s picture

No, "token" wasn't anything specific. It could be any {{ object.property }} printed in the twig code.

Better example from the {% trans %} change record:

Twig Source

{% trans %}
  Submitted by {{ author.name }} on {{ node.date }}
{% endtrans %}

Generated Translation string

Before:

Submitted by @name on @date.

Now:

Submitted by @author.name on @node.date.
gábor hojtsy’s picture

Status: Needs review » Needs work

Ok, can you update the test than to include multiple token providers, not just 'token'? I think that would make understanding the intention better. Now that the variable is $token in the parsing code and also in the twig file is misleading/confusing. Thanks!

herom’s picture

Status: Needs work » Needs review
StatusFileSize
new2.51 KB

test updated.

gábor hojtsy’s picture

Status: Needs review » Fixed

Looks great, thanks.

  • Commit e2513c1 on 6.x-3.x by Gábor Hojtsy:
    Issue #2283379 by herom: Update for complex tokens in Twig.
    
gábor hojtsy’s picture

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

Right status.

  • Gábor Hojtsy committed e2513c1 on 7.x-2.x
    Issue #2283379 by herom: Update for complex tokens in Twig.
    

  • Gábor Hojtsy committed e2513c1 on 7.x-3.x
    Issue #2283379 by herom: Update for complex tokens in Twig.
    
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