Re: Configure flag for turning on/off the function alias"_()" for "gettext()"

From: Date: Sun, 05 Oct 2003 00:35:13 +0000
Subject: Re: Configure flag for turning on/off the function alias"_()" for "gettext()"
References: 1  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-622@lists.php.net to get a copy of this message
Hi, Perhaps it'd be better to write a feature request at http://bugs.php.net/ . I like your idea, but could it be that simple by preparing a function like __() and using it everywhere instead. <?php // sample if ($CONFIG['DEBUG_MODE']) { function __($str) { $retval = gettext($str); if ($str == $retval) { trigger_error("missing translation for "$str", E_USER_NOTICE); } return $retval; } } else { function __($str) { return gettext($str); } } ?> Moriyoshi > > Not sure if this is right place for this, but anyways: > > Wouldn't it be nice to have a configure flag for turning on/off the > function alias _() for the gettext() function, or maybe even a php.ini > setting if that's possible. > > If this feature existed it would be possible to create your own _() > function which could do things in addition to calling gettext(). > > Example: > function _($string) { > $ret = gettext($string); > if ($ret == $string) { > /*** > ... notify of missing msgid in .mo/.po file ... > ***/ > } > return $ret; > } > > This however would be slower than using the alias _() directly, but it > would be _VERY_ nice to have for debugging and development purposes. > > -- > Bjørn Tore Hagen > Programmer > > -- > PHP Internationalization Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.i18n (#622) next »