X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fsbin%2Fextract-message-catalog;h=34d44ed6604981963bdf60f7da5298559406a849;hb=1b7db3fe3d9049141a13721d658747fe2a006859;hp=c5d4d89531ce575033620f7d815cc72c59e630ac;hpb=f7fd2a3e34da751cbc02bbf215e99c6dc89adc15;p=freeside.git diff --git a/rt/sbin/extract-message-catalog b/rt/sbin/extract-message-catalog index c5d4d8953..34d44ed66 100644 --- a/rt/sbin/extract-message-catalog +++ b/rt/sbin/extract-message-catalog @@ -1,9 +1,9 @@ #!/usr/bin/perl -w -# {{{ BEGIN BPS TAGGED BLOCK +# BEGIN BPS TAGGED BLOCK {{{ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -23,7 +23,9 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +# 02110-1301 or visit their web page on the internet at +# http://www.gnu.org/copyleft/gpl.html. # # # CONTRIBUTION SUBMISSION POLICY: @@ -43,7 +45,7 @@ # works based on those contributions, and sublicense and distribute # those contributions and any derivatives thereof. # -# }}} END BPS TAGGED BLOCK +# END BPS TAGGED BLOCK }}} # Portions Copyright 2002 Autrijus Tang use strict; @@ -98,7 +100,7 @@ sub extract_strings_from_code { local $/; return if ( -d $_ ); - return if ( $File::Find::dir =~ 'lib/blib|lib/t/autogen|var|m4|local' ); + return if ( $File::Find::dir =~ 'lib/blib|lib/t/autogen|var|m4|local|\.svn' ); return if ( /\.po$|\.bak$|~|,D|,B$|extract-message-catalog$/ ); return if ( /^[\.#]/ ); return if ( -f "$_.in" ); @@ -195,6 +197,7 @@ sub update { while (@lines) { my $msghdr = ""; $msghdr .= shift @lines while ( $lines[0] && $lines[0] !~ /^msgid/ ); + my $msgid = shift @lines; my $msgstr = ""; $msgstr .= shift @lines while ( $lines[0] && $lines[0] =~ /^(msgstr|")/ ); @@ -203,8 +206,8 @@ sub update { chomp $msgid; chomp $msgstr; - $msgid =~ s/^msgid "(.*)"$/$1/ or warn $msgid; - $msgstr =~ s/^msgstr "(.*)"$/$1/ms or warn $msgstr; + $msgid =~ s/^msgid "(.*)"\s*?$/$1/ms or warn "$msgid in $file"; + $msgstr =~ s/^msgstr "(.*)"\s*?$/$1/ms or warn "$msgstr in $file"; $Lexicon{$msgid} = $msgstr; $Header{$msgid} = $msghdr; @@ -229,6 +232,10 @@ sub update { my %seen; $out .= $Header{$_} if exists $Header{$_}; + + + + next if (!$f && $_ && !$Lexicon{$_}); if ( $f && $f !~ /^\s+$/ ) { $out .= "#: $f\n";