[Rt-commit] r15638 - rt/3.8/trunk/sbin
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Aug 29 11:42:16 EDT 2008
Author: sunnavy
Date: Fri Aug 29 11:42:11 2008
New Revision: 15638
Modified:
rt/3.8/trunk/sbin/extract-message-catalog
Log:
improved msg parse in update sub for extract-message-catalog
Modified: rt/3.8/trunk/sbin/extract-message-catalog
==============================================================================
--- rt/3.8/trunk/sbin/extract-message-catalog (original)
+++ rt/3.8/trunk/sbin/extract-message-catalog Fri Aug 29 11:42:11 2008
@@ -234,8 +234,34 @@
chomp $msgid;
chomp $msgstr;
- $msgid =~ s/^msgid "(.*)"\s*?$/$1/ms or warn "$msgid in $file";
- $msgstr =~ s/^msgstr "(.*)"\s*?$/$1/ms or warn "$msgstr in $file";
+
+ $msgid =~ s/^msgid "(.*)"\s*?$/$1/m or warn "$msgid in $file";
+
+ if ( $msgid eq '' ) {
+ # null msgid, msgstr will have head info
+ $msgstr =~ s/^msgstr "(.*)"\s*?$/$1/ms or warn "$msgstr in $file";
+ }
+ else {
+ $msgstr =~ s/^msgstr "(.*)"\s*?$/$1/m or warn "$msgstr in $file";
+ }
+
+ if ( $msgid ne '' ) {
+ for my $msg ( \$msgid, \$msgstr ) {
+ if ( $$msg =~ /\n/ ) {
+ my @lines = split /\n/, $$msg;
+ $$msg =
+ shift @lines; # first line don't need to handle any more
+ for (@lines) {
+ if (/^"(.*)"\s*$/) {
+ $$msg .= $1;
+ }
+ }
+ }
+
+ # convert \\n back to \n
+ $$msg =~ s/(?!\\)\\n/\n/g;
+ }
+ }
$Lexicon{$msgid} = $msgstr;
$Header{$msgid} = $msghdr;
More information about the Rt-commit
mailing list