Closed (fixed)
Project:
Translation template extractor
Version:
6.x-2.0
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Sep 2008 at 15:36 UTC
Updated:
24 Sep 2008 at 07:42 UTC
Invalid marker content in indexpage.module:272 * format_plural($count,t('There is one !type node.',array('!type'=>$type_name)),t('There are @count !type nodes.',array('!type'=>$type_name)))
I don't see an invalid marker and the t() calls work as expected.
Comments
Comment #1
gábor hojtsyIt is invalid, since format_plural() itself performs the t(), so you should not call t() before format_plural. The rule is that you pass single strings to format_plural() in both the singular and plural parameters. If you need something replaced, you should do it after format_plural() returns back. Otherwise you'd get translated versions of the messages in all languages including all kinds of types appear in the database as 'English' strings to translate. You should instead do:
Depending on where you use it, and how $type_name is escaped, I'd also suggest you think about escaping it. This translates the original English strings properly, and only adds the type after the translation is done.
Comment #2
nancydruThank you, Gábor. This is my first time using format_plural, so I guess I just misunderstood it, even with looking at the API.
The type name comes from the node module, so it should be safe. It is not user entered,
Comment #3
gábor hojtsyIf the $type_name is human readable type name, then it is user entered. Only if it is the machine name (eg. what appears in node/add/typename) If the human readable name is used, you should escape it.
Comment #4
nancydruI do a check_plain on it.
Comment #5
gábor hojtsyGreat!
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.