Fix perl syntax in plural rules substitution
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 7 Apr 2009 20:45:50 +0000 (20:45 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 7 Apr 2009 20:45:50 +0000 (20:45 +0000)
wwwtools/pg-make-po

index f443e42e055cb5d9317516164eaa4d534ef52ebc..417f3ef20e9993e1b96f5a0e0cf8593d79b515a5 100755 (executable)
@@ -24,7 +24,7 @@ my $msgmerge = $ENV{'MSGMERGE'} || 'msgmerge';
 my $msgfmt = $ENV{'MSGFMT'} || 'msgfmt';
 
 # order as in the GNU gettext manual
-my %plural_rules = {
+my %plural_rules = (
     'ja' => 'nplurals=1; plural=0;',
     'en' => 'nplurals=2; plural=n != 1;',
     'fr' => 'nplurals=2; plural=n>1;',
@@ -33,9 +33,9 @@ my %plural_rules = {
     'cs' => 'nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;',
     'pl' => 'nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;',
     'sl' => 'nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;',
-};
+);
 
-my %plural_forms = {
+my %plural_forms = (
     'af' => 'en',
     'cs' => 'cs',
     'de' => 'en',
@@ -60,7 +60,7 @@ my %plural_forms = {
     'tr' => 'ja',
     'zh_CN' => 'ja',
     'zh_TW' => 'ja',
-};
+);
 
 my @all_languages;
 
@@ -125,6 +125,7 @@ foreach (@ARGV) {
 
         if (! -f "$dirname/po/$lang.po.mrg" && -f "$dirname/po/$lang.po.new") {
             my $pe = $plural_rules{$plural_forms{$lang}};
+            $pe =~ s/\&/\\\&/g;
             system("cat $dirname/po/$lang.po.new | sed '/Plural-Forms:/s/nplurals=INTEGER; plural=EXPRESSION;/$pe/' >$outdir/$catalogname-$lang.po");
         }