diff --git a/scripts/po/extract.pl b/scripts/po/extract.pl index 80a9e5a5..4016403f 100755 --- a/scripts/po/extract.pl +++ b/scripts/po/extract.pl @@ -48,17 +48,18 @@ sub extract { # in single or double quotes including concatenated strings like 'one' . "two" while ($data =~ /(translate|i18n)\(\s*(((\s*\.\s*)?('((\\')?[^']*)*[^\\]'|"((\\")?[^"]*)*[^\\]"))+)\s*\)/sg) { - # Call out to php to parse string.. - my ($in, $out); - open2($in, $out, 'php -q'); - print $out ''; - close $out; - my $text = join('', <$in>); - close $in; - $text =~ s/\"/\\\"/sg; # escape double-quotes - $strings{qq{gettext("$text")}}++; + # Call out to php to parse string.. + my ($in, $out); + open2($in, $out, 'php -q'); + print $out ''; + close $out; + my $text = join('', <$in>); + close $in; + next if ( $text eq "" ); + $text =~ s/\"/\\\"/sg; # escape double-quotes + $strings{qq{gettext("$text")}}++; } # grab phrases of this format: translate(array('one' => '...', 'many' => '...')) @@ -72,6 +73,7 @@ sub extract { # grab phrases of this format: translate(array('text' => '...', ...)) while ($data =~ /translate\(\s*array\('text'\s*=>\s+'(.*?[^\\])'/sg) { my $text = $1; + next if ( $text eq "" ); $text =~ s/\"/\\\"/sg; # escape double-quotes $strings{qq{gettext("$text")}}++; } diff --git a/scripts/po/rebuild-translations.sh b/scripts/po/rebuild-translations.sh index b6a044b9..12c220fa 100755 --- a/scripts/po/rebuild-translations.sh +++ b/scripts/po/rebuild-translations.sh @@ -12,7 +12,7 @@ PODIR="po" LOCALEDIR="locale" APPLICATION="rscds" -${POTOOLS}/extract.pl htdocs inc > ${PODIR}/strings.raw +${POTOOLS}/extract.pl htdocs inc ../awl/inc > ${PODIR}/strings.raw xgettext --keyword=_ -C --no-location --output=${PODIR}/messages.tmp ${PODIR}/strings.raw sed -e 's/CHARSET/UTF-8/' <${PODIR}/messages.tmp >${PODIR}/messages.po rm ${PODIR}/messages.tmp