Problem/Motivation

In the template file twitter-pull-listing.tpl.php the "Follow @username" button is translated in this way: t("Follow @$tweet->screenname"), this creates an entry in the locale_source for every username, multiply this per every page where this username appears and in an average site you will get several hundred thousand entries in that table.

Proposed resolution

Use the variable injection that comes along with the t() function: t("Follow !screenname", array('!screenname'=>"@{$tweet->screenname}").

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

esolitos created an issue. See original summary.

esolitos’s picture

Status: Active » Needs review
FileSize
900 bytes

Patch.

joachim’s picture

Status: Needs review » Needs work

Good catch!

Though a few problems:

- the placeholder should be @ rather than !. I expect twitter usernames can't have anything nasty in them, but it's best to be safe.

- the replacement value should be a straight variable. No need to quote. And the @ won't do anything here.

- one space each side of the => please.

esolitos’s picture

Assigned: Unassigned » esolitos

I'll fix the patch in the next days before leaving for Dublin. :)

>And the @ won't do anything here.

What do you mean? The "@" is there to appear front of the Tw username, I added to to keep it like it was before.

esolitos’s picture

Status: Needs work » Needs review
FileSize
901 bytes

New patch with suggestions, I left the "@" in front of the screen name, since it's quite standard when referring to Twitter, and also was used before, so most likely we should not change the output.

joachim’s picture

> The "@" is there to appear front of the Tw username, I added to to keep it like it was before.

Ah, of course! Sorry, I was being stupid, I was only thinking of the '@' in the context of Drupal's t() placeholders...

> + <?php print l(t("Follow @screenname", array('@screenname' => '@'.$tweet->screenname)), 'https://twitter.com/' . $tweet->screenname, array('attributes'=> array(

Needs a space each side of the . operator too.

esolitos’s picture

FileSize
904 bytes

Damn, why did I change that. :)
I fixed the spacing, new patch should be fine!

(I also fixed another spacing "error" in the file.)