note 34343 deleted from language.constants by danbrown
| From: | danbrown@php.net | Date: | Tue, 26 Jul 2011 20:06:21 +0000 |
| Subject: | note 34343 deleted from language.constants by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181914@lists.php.net to get a copy of this message | ||
Note Submitter: php-comment-2003-july-24 at ryandesign dot de
----
Late reply to fmmarzoa at gmx dot net: You're better off using sprintf format and defining your
strings like this:
define('strArticleDescr', 'Published by %1$s on %2$s in %2$s');
It's more standard than what you're doing. Then instead of outputting it using an eval, do
this:
echo sprintf(strArticleDescr, $article_author, $article_date, $article_lang_name');
And even better for i18n and l10n, don't use defines; use gettext. See the PHP manual section
on gettext and the GNU gettext website. Gettext requires some modification of the way you think
about strings but I find it worthwhile to make that adjustment.