Is strange that there is not a really good solution for this problem, i
think its not very strange. Maybe i ll request this feature, I think is
interesting, useful and not so hard to add.
Anyway, I cannot use "ob_ " functions, i ll have problems with some
functions.
So, the solution seems to extend "_" function, that provides me the
posibility to report "strings" not found.
The bad think is that I ll have to make thousands of modifications in
order to implement this feature in the webpage :(
Thanks to everybody!
Richard Lynch wrote:
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...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php