Re: GetText string not found

From: Date: Tue, 13 Jun 2006 22:25:53 +0000
Subject: Re: GetText string not found
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-237930@lists.php.net to get a copy of this message
On Tue, June 13, 2006 6:30 am, Ruben Rubio Rey wrote: > I am using gettext to get a web page in several languages. > > When gettext does not found an string, it shows the string. > > Is it possible to detect when a string is not found, in order to advis > me ? My experience, if you call it that, with gettext consists of reading the manual and saying "Neat!", so take this with a HUGE grain of salt... One option that MIGHT work would be: function ___ ($string) { //check for existince of the language file/string by hand :-( } Another option, perhaps, would be to have your "default" language be something really... weird, and then the output itself would be icky... I suppose you could do something hacky like: <?php ob_start(); __'GETTEXT_START_MARKER This is the actual message GETTEXT_END_MARKER'; ?> All code/html here. <?php $output = ob_get_contents(); preg_match_all('/GETTEXT_START_MARKER (.*) GETEXT_END_MARKER/U', $output, $gettexts); foreach($gettexts[1] as $unknown){ error_log($unknown); } $output = str_replace(array('GETTEXT_START_MARKER ', ' GETTEXT_END_MARKER'), '', $output); echo $output; ?> Ugh. Maybe a Feature Request at GetText and/or bugs.php.net would be in order... -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#237930) next »