]> git.sesse.net Git - ccbs/blobdiff - intl/Sesse::ExtractGettext.pm
Start i18n stuff.
[ccbs] / intl / Sesse::ExtractGettext.pm
diff --git a/intl/Sesse::ExtractGettext.pm b/intl/Sesse::ExtractGettext.pm
new file mode 100644 (file)
index 0000000..857ee1f
--- /dev/null
@@ -0,0 +1,26 @@
+
+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);
+}
+
+
+