I just installed this module because I had a contributed translation. As soon as I left the settings page, I got these messages:

* Invalid marker content in sitedoc.module:785 * t($filter_name->name)
* Invalid marker content in sitedoc.module:879 * t($dbname)
* Invalid marker content in sitedoc.module:1122 * t($file->info['description'])
* Invalid marker content in sitedoc.module:1147 * t(implode(', ',$dependencies))
* Invalid marker content in sitedoc.module:1150 * t(implode(', ',$module[$name]['dependents']))
* Invalid marker content in sitedoc.module:1205 * t(ucfirst(strtolower($type)))
* Invalid marker content in sitedoc.module:1212 * t($string)
* Invalid marker content in gotcha.module:456 * t($msg['sitename'])
* Invalid marker content in gotcha.module:285 * watchdog(t('Contact spam is to be deleted; id=!id',array('!id'=>$id)),WATCHDOG_WARNING)

What do I do now?

Comments

nancydru’s picture

Status: Active » Fixed

Well, I looked at every line mentioned and tweaked them a bit (some of them were messed up by the translation extractor). The messages went away.

gábor hojtsy’s picture

Title: Error messages » Export error messges into .po files
Category: support » task
Status: Fixed » Active

When the extraction is run, the messages are entered into the Drupal message list. They are displayed on your next page view. This is not ideal (it would be better to include the errors in the .PO file as comments for example), but this is how it works now.

We can make this issue a task to export error messages into .po files :)

nancydru’s picture

That's up to you. My problems are solved for now. It was just very disconcerting on my first use to see a bunch of errors pop up on a program that had passed coder review with no problems.

gábor hojtsy’s picture

Well, that's probably a feature request to the coder review then (if you mean that modules code review by "passed code review"). Coder module does not check for translatability problems yet as far as I know.

nancydru’s picture

Just so I understand: One may not use the t() function on variables other than substituted values? That's interesting because I'm pretty sure it was you who wanted me to include $user->name in a t() in a patch I submitted a while ago. So I guess I got confused.

gábor hojtsy’s picture

Yes, most of the time t() should only be used on literal strings, so these errors are shown because the module in question did not do that. I don't remember telling you to t() user names, but would happily elaborate on the specific issue if you have an exact link. You should not use t() on a username, but only on literal strings most of the time. The only exceptions are stuff when you ensured that the variable string in question is always generated from a literal string which is translatable with some method. Eg. watchdog type names are translatable although not wrapped in t(), because they are collected as translatables, so we can do t($type) on a watchdog type.

nancydru’s picture

I just looked it up and I guess I misread it then. It was using a substitution.

nancydru’s picture

Status: Active » Closed (works as designed)
gábor hojtsy’s picture

Status: Closed (works as designed) » Active

I made this issue a task to export error messages into .po files, which is a worthwhile goal IMHO, so keep it open.

nancydru’s picture

Okay

aturetta’s picture

Version: 5.x-1.x-dev » 7.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new3.53 KB

I think this is a good thing, so I took a shot at it.

The following patch does:

  • keep messages in memory even if running from module or CLI
  • if generating a single file, attach error messages to the file
  • if generating multiple file, save messages as 'potx-messages.pot'
  • fix a php5.3 warning at potx.inc(293)

Status: Needs review » Needs work

The last submitted patch, potx-save-messages-in-po.patch, failed testing.

aturetta’s picture

StatusFileSize
new3.54 KB

ouch, first patch ever since git

aturetta’s picture

Status: Needs work » Needs review

try again

Status: Needs review » Needs work

The last submitted patch, potx-save-messages-in-po.patch, failed testing.

gábor hojtsy’s picture

I'm not sure you are working off the current branch (that should not have potx_status() at all in it).

aturetta’s picture

Version: 7.x-2.x-dev » 7.x-1.x-dev
Status: Needs work » Needs review

You are right, I completely missed 2.x refactoring..... one hour coding lost :-(

aturetta’s picture

#13: potx-save-messages-in-po.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, potx-save-messages-in-po.patch, failed testing.

aturetta’s picture

Status: Needs work » Needs review
StatusFileSize
new3.55 KB

Sorry to spam the issue, but I wanted to validate that I can write a correct patch.

patch for 7.x-1.x branch

Status: Needs review » Needs work

The last submitted patch, potx-save-messages-in-po.patch, failed testing.

aturetta’s picture

Status: Needs work » Needs review
StatusFileSize
new3.58 KB

What the ....
I suppose using empty() on an array prints a NOTICE. Let's try again.

Status: Needs review » Needs work

The last submitted patch, potx-save-messages-in-po.patch, failed testing.

aturetta’s picture

Status: Needs work » Needs review
StatusFileSize
new3.87 KB

Now I understand.
During tests the errors are stored STRUCTURED, so implode() cannot be used that simply.

re-rolled for 7.x-1.x-dev, just for learning purposes. I know it won't be committed on that branch. Thanks for patience.