f5c97ffb8efb0e49f76b48fcdffb05d5e48fbfb0
[ccbs] / intl / Sesse::GettextizeTemplates.pm
1
2 package Sesse::GettextizeTemplates;
3 use strict;
4 use warnings;
5 use Locale::gettext qw(gettext);
6 use Template::Directive;
7
8 our @ISA = qw(Template::Directive);
9
10 sub textblock {
11         my ($self, $text) = @_;
12
13         $text =~ s/(<(h[1-6]|p|td|th|title|input|span|li|_)[^>]*>)(.*?)(<\/\2>)/$1.gettext($3).$4/seg;
14         $text =~ s/<\/?_>//g;
15
16         return $self->SUPER::textblock($text);
17 }
18
19
20