Because of the following errors I am unable to generate POT templates and translate the module. I'm using the Translation template extractor module.
Invalid marker content in comment_notify.module:323 * t(variable_get('comment_notify_default_mailtext',DEFAULT_MAILTEXT),array('!commname'=>$comment->name,'!commtext'=>$comment->comment,'!commsubj'=>$comment->subject,'!comment_url'=>url('node/'.$nid,array('absolute'=>TRUE)).'#comment-'.$cid,'!node_title'=>$node->title,'!node_teaser'=>$node->teaser,'!mission'=>variable_get('site_mission',''),'!node_body'=>$node->body,'!name'=>$alert->name,'!site'=>variable_get('site_name','drupal'),'!uri'=>$base_url,'!uri_brief'=>drupal_substr($base_url,drupal_strlen('http://')),'!date'=>format_date(time()),'!login_uri'=>url('user',array('absolute'=>TRUE)),'!edit_uri'=>url('user/'.$alert->uid.'/edit',array('absolute'=>TRUE)),'!link1'=>url('comment_notify/disable/'.$alert->mymd5,array('absolute'=>TRUE))))
Invalid marker content in comment_notify.module:486 * t(DEFAULT_MAILTEXT)
Invalid marker content in comment_notify.module:355 * watchdog('comment_notify',$watchdog_message,array('!url'=>url('user/'.$alert->uid.'/edit'),'@user_mail'=>$mail),WATCHDOG_NOTICE,l(t('source comment'),'node/'.$nid,array('fragment'=>'comment-'.$alert->cid)))
Comment | File | Size | Author |
---|---|---|---|
#15 | comment_notify.watchdog.diff | 1.89 KB | Freso |
#13 | comment_notify.watchdog.diff | 1.91 KB | Freso |
#12 | comment_notify.watchdog.diff | 2.28 KB | Freso |
Comments
Comment #1
gregglesI think I can fix the issues on 323 and 486 - can you provide advice on how to fix the error on line 355?
Comment #2
archetwist CreditAttribution: archetwist commentedI'm not sure what is causing the last error. Maybe this will be of some help: http://drupal.org/node/185599#comment-617099
Comment #3
lomz CreditAttribution: lomz commentedGet same errors, but it generates the file, so I started translating it anyway.
Comment #4
archetwist CreditAttribution: archetwist commentedYes, but the template is incomplete.
Comment #5
lomz CreditAttribution: lomz commentedBut covers most of the lines
Comment #6
gregglesThe error on line 355 we can fix by moving the call to watchdog into the if statement above it...so that should be fine.
I looked at this a bit more - the errors from 323 and 486 are because the t function is used to translate the mail message which is something that an admin can specify. So, there is no way to put the t() around a pure string (the way to fix this, afaik).
I'm not sure how to fix the errors on line 323 and 486. These are extraction errors from using a specific extraction tool, right? The locale module built into Drupal core will still be able to find/translate the strings as they are used now, right?
The alternate method, that I could think of, is to create input boxes for the message as it should appear for every language on a site. Would that seem like a reasonable solution for you?
Comment #7
archetwist CreditAttribution: archetwist commentedFrom the extraction tool ;) .
I think you just need to omit the
t()
s, i.e.$message['body'] = variable_get(
instead of$message['body'] = t(variable_get(
.Comment #8
greggles@archetwist - if we omit the t() then
1) The message body won't be localized
2) The replacement of the variables like !comment-uri won't happen
At a minimum we need to use strtr instead of the t(), but I would also like to continue the feature where the message body is localized.
Comment #9
archetwist CreditAttribution: archetwist commentedMaybe Gábor Hojtsy could give us advice on this problem. He maintains the module I mentioned.
Comment #10
gregglesA more accurate title for this issue.
According to http://groups.drupal.org/node/15177 there isn't really a good solution for this just yet.
Comment #11
Freso CreditAttribution: Freso commentedYou should never, ever use
t()
around a user configurable string, which is done here withnode_notify_default_mailtext
(which leads to one wondering, why are there twoDEFINE
s and admin settings, but only one site variable?). This is a pit filled with snakes and other creepy critters and makes Baby Jesus cry. :(Make it a site variable, and if people need translations of the site variable, that's one of the things the i18n module (suite) do (and which will hopefully get added to D7... if only someone would find the time to actually work on it :/).
watchdog()
call on line 433 should be moved to lines 427 and 430, instead of feeding a variable to it.Comment #12
Freso CreditAttribution: Freso commentedHere's a patch with just the
watchdog()
stuff. I'm not sure how you will want to handle the DEFINEs' variables. (Why isn't it using Token, anyway?)Comment #13
Freso CreditAttribution: Freso commentedActually, I think this is a better way to attack this problem.
Comment #14
gregglesThanks for the help, Freso. See #273112: Provide realname support in the existing token system for token.
Comment #15
Freso CreditAttribution: Freso commentedYou're welcome. :) Here's a patch two lines shorter, FWIW. Also, I think this patch could safely be applied while waiting for a fix to the other issue.
Comment #16
gregglesFixed - http://drupal.org/cvs?commit=169222
I somehow skipped over this earlier...
patches always welcome :p
Comment #17
gregglesI think the extractor no longer complains about these so I'm marking it fixed to reflect the last action taken.