note 108594 added to function.gettext

From: Date: Wed, 09 May 2012 10:57:48 +0000
Subject: note 108594 added to function.gettext
Groups: php.notes 
Request: Send a blank email to php-notes+get-187542@lists.php.net to get a copy of this message
gettext returns the headers from .mo files if the message parameter is set to empty. So if you are for example using Smarty blocks, make sure that the values given checks if the text has content or else your text will have a bunch of headers printing. If you are putting a variable to the gettext, like so: _($text); you are better of making another function like this: <?php function __($text){ if(empty($text)) return ""; else gettext($text); } ?> ---- Server IP: 195.139.129.18 Probable Submitter: 88.88.240.228 ---- Manual Page -- http://www.php.net/manual/en/function.gettext.php Edit -- https://master.php.net/note/edit/108594 Del: integrated -- https://master.php.net/note/delete/108594/integrated Del: useless -- https://master.php.net/note/delete/108594/useless Del: bad code -- https://master.php.net/note/delete/108594/bad+code Del: spam -- https://master.php.net/note/delete/108594/spam Del: non-english -- https://master.php.net/note/delete/108594/non-english Del: in docs -- https://master.php.net/note/delete/108594/in+docs Del: other reasons-- https://master.php.net/note/delete/108594 Reject -- https://master.php.net/note/reject/108594 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187542) next »