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)))

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

I think I can fix the issues on 323 and 486 - can you provide advice on how to fix the error on line 355?

archetwist’s picture

I'm not sure what is causing the last error. Maybe this will be of some help: http://drupal.org/node/185599#comment-617099

lomz’s picture

Get same errors, but it generates the file, so I started translating it anyway.

archetwist’s picture

Yes, but the template is incomplete.

lomz’s picture

But covers most of the lines

greggles’s picture

The 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?

archetwist’s picture

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?

From 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(.

greggles’s picture

@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.

archetwist’s picture

Maybe Gábor Hojtsy could give us advice on this problem. He maintains the module I mentioned.

greggles’s picture

Title: Translation not possible - errors when trying to generate POT templates » potx extraction not possible - errors when trying to generate POT templates
Status: Active » Postponed

A 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.

Freso’s picture

Title: potx extraction not possible - errors when trying to generate POT templates » Improper string handling
Version: 6.x-1.0 » 6.x-1.1
Status: Postponed » Active
  1. You should never, ever use t() around a user configurable string, which is done here with node_notify_default_mailtext (which leads to one wondering, why are there two DEFINEs 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 :/).

  2. The watchdog() call on line 433 should be moved to lines 427 and 430, instead of feeding a variable to it.
Freso’s picture

Status: Active » Needs work
FileSize
2.28 KB

Here'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?)

Freso’s picture

Actually, I think this is a better way to attack this problem.

greggles’s picture

Thanks for the help, Freso. See #273112: Provide realname support in the existing token system for token.

Freso’s picture

You'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.

greggles’s picture

Fixed - http://drupal.org/cvs?commit=169222

I somehow skipped over this earlier...

This is a pit filled with snakes and other creepy critters and makes Baby Jesus cry. :(

patches always welcome :p

greggles’s picture

Status: Needs work » Fixed

I think the extractor no longer complains about these so I'm marking it fixed to reflect the last action taken.

Status: Fixed » Closed (fixed)

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