Fix po2localization so it ignores fuzzy translations (thanks, Francois!).
authorRyan C. Gordon <icculus@icculus.org>
Thu, 18 Jun 2015 13:45:12 -0400
changeset 880 f948cd94b3b3
parent 879 c2afc800b743
child 881 1fa99479169e
Fix po2localization so it ignores fuzzy translations (thanks, Francois!).

In the best case they could totally break the installation (e.g. if they
contain a '%s'), and in the worst case they could make dialogs or
buttons incomprehensible or misleading.
misc/po2localization.pl
--- a/misc/po2localization.pl	Thu Jun 18 12:18:57 2015 -0400
+++ b/misc/po2localization.pl	Thu Jun 18 13:45:12 2015 -0400
@@ -37,6 +37,7 @@
 
     my $comment = '';
     my $currentlang = '';
+    my $fuzzy;
 
     while (<POIO>) {
         chomp;
@@ -52,6 +53,10 @@
             }
             next;
         }
+        if (/\A\#,.*\bfuzzy\b/) {
+            $fuzzy = 1;
+            next;
+        }
 
         next if /\A\#/;
 
@@ -108,6 +113,7 @@
                         die("unexpected line: $_\n");
                     }
                 }
+                $msgstr = '' if ($fuzzy);
 
                 if ($template) {
                     push @strings, $msgid;  # This is a list, to keep original order.
@@ -117,6 +123,7 @@
                     $msgstrs{$currentlang}{$msgid} = $msgstr;
                 }
             }
+            $fuzzy = undef;
         }
     }