[Rt-commit] r13553 - in rt/3.8/trunk: sbin
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Jun 23 19:44:22 EDT 2008
Author: sunnavy
Date: Mon Jun 23 19:44:21 2008
New Revision: 13553
Modified:
rt/3.8/trunk/ (props changed)
rt/3.8/trunk/sbin/extract-message-catalog
Log:
r13744 at sunnavys-mb: sunnavy | 2008-06-24 07:32:42 +0800
handle multi line loc strings
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 Mon Jun 23 19:44:21 2008
@@ -218,7 +218,7 @@
my $is_english = ( $lang =~ /^en(?:[^A-Za-z]|$)/ );
foreach my $str ( sort keys %{$FILECAT} ) {
- $Lexicon{$str} ||= '';;
+ $Lexicon{$str} ||= '';
}
foreach ( sort keys %Lexicon ) {
my $f = join ( ' ', sort map $_->[0].":".$_->[1], @{ $FILECAT->{$_} } );
@@ -251,7 +251,7 @@
$var =~ s/\s*$//;
$out .= "#. ($var)\n" unless $seen{$var}++;
}
- $out .= "msgid \"$_\"\nmsgstr \"$Lexicon{$_}\"\n\n";
+ $out .= 'msgid ' . fmt($_) . "msgstr \"$Lexicon{$_}\"\n\n";
}
open PO, ">$file" or die $!;
@@ -267,6 +267,23 @@
return $text;
}
+sub fmt {
+ my $str = shift;
+ return "\"$str\"\n" unless $str =~ /\n/;
+
+ my $multi_line = ($str =~ /\n(?!\z)/);
+ $str =~ s/\n/\\n"\n"/g;
+
+ if ($str =~ /\n"$/) {
+ chop $str;
+ }
+ else {
+ $str .= "\"\n";
+ }
+ return $multi_line ? qq(""\n"$str) : qq("$str);
+}
+
+
__END__
# Local variables:
# c-indentation-style: bsd
More information about the Rt-commit
mailing list