Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello
It would be nice if there was translation support for "add to queue" and "remove from queue" texts.
Kind Regards
Ali Majdzadeh Kohbanani
Comment | File | Size | Author |
---|---|---|---|
#8 | nodequeue-translatable-add-remove-link-351085-8.patch | 7.7 KB | fmjrey |
#7 | nodequeue-translatable-add-remove-link-351085-7.patch | 1.53 KB | fmjrey |
Comments
Comment #1
ezra-g CreditAttribution: ezra-g commentedGood point -- We should translate the custom links.
Comment #2
Ali Majdzadeh Kohbanani CreditAttribution: Ali Majdzadeh Kohbanani commentedThanks, hope to see that working in future releases. By the way, thanks a lot for such a nice module.
Kind Regards
Ali Majdzadeh Kohbanani
Comment #3
pfaocleComment #4
fmjrey CreditAttribution: fmjrey commentedYeah, 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
Comment #5
jaydub CreditAttribution: jaydub commentedPart 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
Comment #6
BouM CreditAttribution: BouM commentedHi 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
Comment #7
fmjrey CreditAttribution: fmjrey commentedHere'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.
Comment #8
fmjrey CreditAttribution: fmjrey commentedHere's the patch against HEAD corresponding to comment #6.
My editor removes unnecessary spaces, these are in the patch as well.
Comment #9
fmjrey CreditAttribution: fmjrey commentedComment #10
ezra-g CreditAttribution: ezra-g commentedPassing 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));
?
Comment #11
amateescu CreditAttribution: amateescu commentedjaydub 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.
Comment #12
shadysamir CreditAttribution: shadysamir commentedNothing on this yet?
Comment #13
Chris CharltonAny further testing needed?