Once the string "send this %type" has been translated, there's no effect.
Whatever language the site is viewed in, there's always the link "send this %type" in English.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | send.module.patch | 853 bytes | ngstigator |
Once the string "send this %type" has been translated, there's no effect.
Whatever language the site is viewed in, there's always the link "send this %type" in English.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | send.module.patch | 853 bytes | ngstigator |
Comments
Comment #1
allie mickaYou may be seeing a variable that you can change on the content type settings page.
The "send this %type" string is the default for the link text, and is activated when you enable send for a node type.
Please go back to the node type settings page and see if you can change the string. If so, we can close this bug.
Comment #2
Marc Bijl commentedHi, thanks for the quick reply. Yes, I know that variable, and I have already changed it (e.g. into "tell a friend", which is well known all over the world).
The thing is, I want to use the text for this link in two languages: both in English and in Dutch.
Usually I try localization first. Look for the string, translate it into Custom-English (en-US) en Dutch (nl) and see if it works. Actually, it doesn't.
If it doesn't, there's the i18n.module. To get additional things translated, e.g. site name, mission, slogan and footer, it's possible to add the following code to settings.php:
When administering my site in Dutch (language prefix nl in address bar), I can define these additional variables for the Dutch site. The same thing (administering with language prefix en-US in address bar) for the English site. This way, I now have both an English and a Dutch footer, for example.
Tried to do this with additional i18n variables for the send.module, using 'linktext' and 'subject'. For some reason, this doesn't work either. So, variables might be wrong, send.module might miss something, i18n.module might go wrong somewhere, or... yes indeed, I'm guilty ;)
Hope this makes some sense, and would be great if you can help. Cheers!
Comment #3
ngstigator commentedJust wondering whether you've found a fix for this.
Looking at the code for 4.7, it seems that the new version has better imtegration with internationalization.
Cheers
Comment #4
ngstigator commentedI changed the implementation of hook_link in send.module to:
function send_link($type, $node=null) {
$type = str_replace('-','_',$node->type);
$links = array();
if ($node && in_array($type,variable_get('send_types',array())) && user_access('send nodes')) {
$linktext = 'send this ' . $type;
$links[] = l(t($linktext),"send/$node->nid",array('title' => t('send this page to a friend')));
}
return $links;
}
Now the send this %type link is translatable. All you have to do is manage your strings in localization to output in the respective languages.
Hope this helps.
Comment #5
Marc Bijl commentedHi Chris,
Excellent stuff, your solution really rocks! Thanks a lot mate!
Wish I had the skills to develop this kind of things myself... It was therefore I decided to use the general term "tell a friend" for both languages; it took too much time to dig into it...
Shouldn't you suggest your code as a patch?
Comment #6
ngstigator commentedThis is more of a hack than anything else, but I'll post the patch anyway in case people find it useful. I don't want to spend too much more time code diving since the focus seems to be on 4.7 now.
Cheers
Comment #7
hip commentedHi,
Maybe focus is on 4.7 but I still think, 4.6 version should be updated to a fair working level. I'm sure many of us can't afford (I mean time + clients' budgets to pay for it) updating our Drupal installations to 4.7, knowing that in the real life, hacks and snippets have been developed for 4.6.
Anyway, to the above posted patch (#6 by chris_five), I'd suggest adding a line and modifying the next one as showed below. For node type being 'event' (as flexinode) I didn't get the word 'event', but 'flexinode_1'. The following corrects it.
It would be really nice if someone tests it and applies it to the send.module for 4.6 version. I'm doing ok with the patch, though.
Thanx,
hip
Comment #8
Marc Bijl commentedHmm, after more than half a year or so, I picked up one of my sites again, upgraded it to 4.7.4 and tried to get the translation of "send this %type" done again. Unfortunately, the send module changed in such a way that I can't find out how to do it now...
Comment #9
allie mickaIf I understand this correctly, running the linktext thru t() should set things straight.
The link string is from a variable set at admin/send, admin/settings/content-types, or during node creation (if you checked the "allow changes on every item" box). So, the value of the link can vary by module, node type, or even node and it might read "send to friend", "send this page", or even "send this article about lemons to your favorite bartender".
Hopefully that's OK, and you will be able to set corresponding translation strings for each of these variants.
I have committed the change which allows this, so please reopen the issue if it's not working for you.
Comment #10
Marc Bijl commentedSeems to work pretty good - although not tested extensively yet.
Anyway: many thanks!
Comment #11
(not verified) commented