Hello
It would be nice if there was translation support for "add to queue" and "remove from queue" texts.

Kind Regards
Ali Majdzadeh Kohbanani

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Title: Add translation support for "add to queue" link text » Custom add/remove link text should be translated
Component: User interface » Code
Category: feature » bug

Good point -- We should translate the custom links.

Ali Majdzadeh Kohbanani’s picture

Thanks, hope to see that working in future releases. By the way, thanks a lot for such a nice module.

Kind Regards
Ali Majdzadeh Kohbanani

pfaocle’s picture

Version: 6.x-2.0-rc3 » 7.x-2.x-dev
fmjrey’s picture

Yeah, would be great to have these translatable.
I'm no php developer but here are some pointers on how to do this:
http://drupal.org/node/579722#comment-3114550

jaydub’s picture

Part of the problem here is that variables are not supposed to be passed to the t() function which given that the add / remove from queue link strings here are undefined in the module code they are variable and thus not a candidate for use by t().

From API docs: http://api.drupal.org/api/function/t/6

"Because t() is designed for handling code-based strings, in almost all cases, the actual string and not a variable must be passed through t().

Extraction of translations is done based on the strings contained in t() calls. If a variable is passed through t(), the content of the variable cannot be extracted from the file for translation."

See more discussion on this subject here:

http://groups.drupal.org/node/15177

BouM’s picture

Hi everybody,

I find the solution to this problem.

On the nodequeue.module line 2278, you have to change :

$text = str_replace('%subqueue', $subqueue->title, $text);

by

$text = str_replace('%subqueue', t($subqueue->title), t($text));

So, you can add translation for your add/ remove link like :

Remove from the %subqueue listing ->Retirer du listing %subqueue
Add to the %subqueue listing : Ajouter au listing %subqueue

You can also add translation for your subqueue title

fmjrey’s picture

Here's the patch against 6.x-2.x-dev corresponding to comment #6.
My editor removes unnecessary spaces, these are in the patch as well.

fmjrey’s picture

Here's the patch against HEAD corresponding to comment #6.
My editor removes unnecessary spaces, these are in the patch as well.

fmjrey’s picture

Status: Active » Needs review
ezra-g’s picture

Status: Needs review » Needs work

Passing in t($text) as the 3rd (subject) seems like awkward use of str_replace().

Wouldn't correct use of t() really call for $title = t($title, array('%subqueue' => $subqueue->title)); ?

amateescu’s picture

Category: bug » feature

jaydub is correct in #5, we can't use t() for user defined strings. The solution here would be to use i18nstrings from the i18n module.

shadysamir’s picture

Nothing on this yet?

Chris Charlton’s picture

Any further testing needed?