Token replacement can accept a specific language in its options. The [user:name] token calls format_username() but it cannot pass that language code option through even though there is a t() call in format_username().

CommentFileSizeAuthor
#1 1121898-format_username-options.patch982 bytesfranz

Comments

franz’s picture

Status: Active » Needs review
StatusFileSize
new982 bytes

This patch allows the $options argument.

dave reid’s picture

Status: Needs review » Needs work

Needs to be re-rolled for 8.x core changes, and also make sure to pass $options through to the drupal_alter() as well.

dave reid’s picture

Title: format_username() should be able to pass an $options parameter through to t() » Entity label callbacks should support an $options parameter (language codes for t())
Issue tags: +D8MI

I'm going to add this to the D8MI initiative and widening the scope.

gábor hojtsy’s picture

Hm, can you help work on this one Dave? It would be very appreciated. Thanks!

yesct’s picture

Maybe an updated issue summary and/or a specific remaining tasks list would let someone help with this?
This looks like it might be challenging.

Dave, #2 seems still needed. Any details you can add?

xjm’s picture

yesct’s picture

we're just using the general needs issue summary update tag.

pwieck’s picture

Issue tags: -Needs reroll

removing reroll tag since this is beyond a reroll.

jair’s picture

Issue tags: +Needs reroll

Needs reroll

franz’s picture

Issue tags: -Needs reroll

The function on my patch does not even exist anymore, and the one in it's place (user_format_name()) is deprecated, so it should be obvious, it's not a matter of reroll anymore.

Concerning this issue, it's not very clear to me what needs to be changed, since all of those change in core. Is Drupal\user\Entity\User::getUsername() ? If so, must also change Interface, right? By widening the scope, you mean other entities also need similar changes? Which ones?

mgifford’s picture

Assigned: dave reid » Unassigned
Issue summary: View changes
gábor hojtsy’s picture

Status: Needs work » Closed (cannot reproduce)

In Drupal 8 now you can just get the translation desired and pass that along:

$account->getTranslation('de');
whatever_works_with_account($account);

quietone’s picture