--- /dev/null
+
+package Sesse::ExtractGettext;
+use strict;
+use warnings;
+use Template::Directive;
+
+our @ISA = qw(Template::Directive);
+
+sub textblock {
+ my ($self, $text) = @_;
+
+ while ($text =~ s/<(h[1-6]|p|td|th|title|input|span|li|_)[^>]*>(.*?)<\/\1>//s) {
+ my $text = $2;
+ $text =~ s/\n/\\n"\n"/g;
+ $text =~ s/(.)"(?!\n)/$1\\"/g;
+
+ print "msgid \"$text\"\n";
+ print "msgstr \"\"\n";
+ print "\n";
+ }
+
+ return $self->SUPER::textblock($text);
+}
+
+
+