Make a workaround for stupid gettext("") borkage.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 17 Jul 2005 10:49:48 +0000 (10:49 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 17 Jul 2005 10:49:48 +0000 (10:49 +0000)
intl/Sesse::GettextizeTemplates.pm

index f5c97ffb8efb0e49f76b48fcdffb05d5e48fbfb0..26f01c0634236e43696be7e125e705247f8d9207 100644 (file)
@@ -2,15 +2,23 @@
 package Sesse::GettextizeTemplates;
 use strict;
 use warnings;
-use Locale::gettext qw(gettext);
+use Locale::gettext;
 use Template::Directive;
 
 our @ISA = qw(Template::Directive);
 
+# blah!
+sub mygettext {
+       my $text = shift;
+
+       return "" if ($text eq "");
+       return Locale::gettext::gettext($text);
+}
+
 sub textblock {
        my ($self, $text) = @_;
 
-       $text =~ s/(<(h[1-6]|p|td|th|title|input|span|li|_)[^>]*>)(.*?)(<\/\2>)/$1.gettext($3).$4/seg;
+       $text =~ s/(<(h[1-6]|p|td|th|title|input|span|li|_)[^>]*>)(.*?)(<\/\2>)/$1.mygettext($3).$4/seg;
        $text =~ s/<\/?_>//g;
 
        return $self->SUPER::textblock($text);