]> git.sesse.net Git - ccbs/commitdiff
More tweaks on gettext stuff; start tryng to make templates.pot.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sat, 16 Jul 2005 23:17:44 +0000 (23:17 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sat, 16 Jul 2005 23:17:44 +0000 (23:17 +0000)
intl/Sesse::ExtractGettext.pm
intl/make-all-pot.sh [new file with mode: 0755]
intl/make-pot.pl

index 857ee1f2a071c6a1858095a13da72bced89deec9..a505b6e151218a846a30c946d568dadb75987a4e 100644 (file)
@@ -10,11 +10,12 @@ sub textblock {
        my ($self, $text) = @_;
 
        while ($text =~ s/<(h[1-6]|p|td|th|title|input|span|li|_)[^>]*>(.*?)<\/\1>//s) {
        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;
+               my $id = $2;
+               next if $id =~ /^\s*$/;
+               $id =~ s/\n/\\n"\n"/g;
+               $id =~ s/(.)"(?!\n)/$1\\"/g;
        
        
-               print "msgid \"$text\"\n";
+               print "msgid \"$id\"\n";
                print "msgstr \"\"\n";
                print "\n";
        }
                print "msgstr \"\"\n";
                print "\n";
        }
diff --git a/intl/make-all-pot.sh b/intl/make-all-pot.sh
new file mode 100755 (executable)
index 0000000..0078eef
--- /dev/null
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+set -e
+
+rm -f templates/*.pot
+for FILE in templates/*.tmpl; do
+       perl -I../intl ../intl/make-pot.pl $FILE > $FILE.pot
+done
+
+msgcat templates/*.pot > po/templates.pot
+rm -f templates/*.pot
+
index a86d4cfcd07ffa070e52d1024526f0700faadabd..7d5acb6fd94bc93b0c9b3f7c808f9de454c2bb97 100644 (file)
@@ -20,5 +20,7 @@ msgstr ""
 EOF
 
 my $eaten = '';
 EOF
 
 my $eaten = '';
-$template->process($ARGV[0], $vars, \$eaten)
-or die $template->error();
+$template->process($ARGV[0], $vars, \$eaten);
+#      or die $template->error();    # errors don't really matter
+
+print "# eof\n";