Start i18n stuff.
[ccbs] / intl / Sesse::ExtractGettext.pm
1
2 package Sesse::ExtractGettext;
3 use strict;
4 use warnings;
5 use Template::Directive;
6
7 our @ISA = qw(Template::Directive);
8
9 sub textblock {
10         my ($self, $text) = @_;
11
12         while ($text =~ s/<(h[1-6]|p|td|th|title|input|span|li|_)[^>]*>(.*?)<\/\1>//s) {
13                 my $text = $2;
14                 $text =~ s/\n/\\n"\n"/g;
15                 $text =~ s/(.)"(?!\n)/$1\\"/g;
16         
17                 print "msgid \"$text\"\n";
18                 print "msgstr \"\"\n";
19                 print "\n";
20         }
21
22         return $self->SUPER::textblock($text);
23 }
24
25
26