Problem/Motivation

In the print_mail module, the node title is translated with the t()-function. I think this is unnecessary an fills only the translate table.

if (!empty($title)) {
    if (drupal_substr($path, 0, 5) == 'node/') {
      $title = t($title);
    }

    $form['fld_title'] = array(
      '#type' => 'item',
      '#title' => t('Page to be sent'),
      '#value' => '<span id="sent-title">'. l($title, $path, array('attributes' => array('title' => t('View page')))) .'</span>',
      '#id' => 'sent-title',
    );
  }

Maybe it's a good idea to translate other other stings, when is not a node (e.g. a view title).

Proposed resolution

Only translate the title when it's not a node-title.

CommentFileSizeAuthor
#1 avoid-translation-1780220-1.patch404 bytesweri

Comments

weri’s picture

Status: Active » Needs review
StatusFileSize
new404 bytes

Only translate title when it's not a node-title

jcnventura’s picture

Status: Needs review » Closed (duplicate)
jcnventura’s picture

Status: Closed (duplicate) » Needs review

Sorry, too fast.. You're right.

weri’s picture

No problem. I forgot to place a note that also an issue for the D7 version exists.

jcnventura’s picture

Status: Needs review » Fixed

Yes, bugs are usually shared between versions.. Thanks for the patch!

http://drupalcode.org/project/print.git/commit/20a2c1b

Status: Fixed » Closed (fixed)

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

Jorrit’s picture

This was a huge performance problem for my site, because it had a lot of nodes. Every time a visitor (or search engine) visited a mail form page, the language cache was invalidated. The cache also contained all node titles, which consumed a lot of memory. My language cache contains 101092 entries, of which 70336 with a location starting with /printmail. I suggest that anyone with a similar situation remove all strings starting with /printmail from the locales_source table.