From: Steinar H. Gunderson Date: Sat, 16 Jul 2005 23:17:44 +0000 (+0000) Subject: More tweaks on gettext stuff; start tryng to make templates.pot. X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=d7b9d2772f2569450caf412026da1556772e3fa4 More tweaks on gettext stuff; start tryng to make templates.pot. --- diff --git a/intl/Sesse::ExtractGettext.pm b/intl/Sesse::ExtractGettext.pm index 857ee1f..a505b6e 100644 --- a/intl/Sesse::ExtractGettext.pm +++ b/intl/Sesse::ExtractGettext.pm @@ -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 $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"; } diff --git a/intl/make-all-pot.sh b/intl/make-all-pot.sh new file mode 100755 index 0000000..0078eef --- /dev/null +++ b/intl/make-all-pot.sh @@ -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 + diff --git a/intl/make-pot.pl b/intl/make-pot.pl index a86d4cf..7d5acb6 100644 --- a/intl/make-pot.pl +++ b/intl/make-pot.pl @@ -20,5 +20,7 @@ msgstr "" 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";