]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - scripts/mk-error-details-po.pl
Source Format Enforcement (#1234)
[thirdparty/squid.git] / scripts / mk-error-details-po.pl
index 1767467115e857764f6be38f0631d8afc38442af..bd54949f3d7bc1e5d628e26a362a1c32b4a82014 100755 (executable)
@@ -1,17 +1,25 @@
 #!/usr/bin/perl -w
+#
+## Copyright (C) 1996-2023 The Squid Software Foundation and contributors
+##
+## Squid software is distributed under GPLv2+ license and includes
+## contributions from numerous individuals and organizations.
+## Please see the COPYING and CONTRIBUTORS files for details.
+##
+
 #
 # Author: Tsantilas Christos
 # (C) 2011 The Measurement Factory
-# 
-# Usage: 
+#
+# Usage:
 #     mk-error-details-po.pl error-details.txt
 #
 # This script read the error-details.txt error details template, and prints to the
-# std output the  contents of a possible .po file.
+# std output the contents of a .PO file template for translation.
 # The error-details.txt file consist of records like the following:
 #
 #  name: X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT
-#  detail: "SSL Certficate error: certificate issuer (CA) not known: %ssl_ca_name"
+#  detail: "SSL Certificate error: certificate issuer (CA) not known: %ssl_ca_name"
 #  descr: "Unable to get issuer certificate"
 #
 # The records separated with an empty line.
@@ -24,7 +32,7 @@ use strict;
 my $File;
 my $mode;
 
-$File = shift @ARGV or 
+$File = shift @ARGV or
     die "Usage: \n ".$0." error-detail-file\n\n";
 
 open(IN, "<$File") or
@@ -47,7 +55,7 @@ while(my $line = <IN>) {
         $rec = $rec.$line;
         $line = <IN>;
         $lineOffset++;
-    } while($line && $line !~ /^\s*$/);
+        } while($line && $line !~ /^\s*$/);
 
     processRecord(\@PO_RECORDS, $rec, $lineNumber);
     $lineNumber= $lineNumber + $lineOffset;
@@ -56,7 +64,8 @@ while(my $line = <IN>) {
 foreach my $poRec (@PO_RECORDS) {
     print $poRec->{"comment"};
     print "msgid ".$poRec->{"msgid"}."\n";
-    print "msgstr ".$poRec->{"msgstr"}."\n\n";
+    # Being a template msgstr is always empty awaiting translated texts.
+    print "msgstr \"\"\n\n";
 }
 
 exit(0);
@@ -89,15 +98,13 @@ sub processRecord
     }
 
     my (%poRecDetail, %poRecDescr);
-    
+
     $poRecDetail{"comment"} = "#: $File+".$currentRec{"name"}.".detail:$lnumber\n";
     $poRecDetail{"msgid"} = $currentRec{"detail"};
-    $poRecDetail{"msgstr"} = $currentRec{"detail"};
     merge(\@$RECS, \%poRecDetail);
 
     $poRecDescr{"comment"} = "#: $File+".$currentRec{"name"}.".descr:$lnumber\n";
     $poRecDescr{"msgid"} = $currentRec{"descr"};
-    $poRecDescr{"msgstr"} = $currentRec{"descr"};
     merge(\@$RECS, \%poRecDescr);
 }