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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to