From b9c376111b7ed3137d7ff72286888e7373487142 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sun, 1 Jul 2012 18:38:07 +0200 Subject: rewrite a horrible perl script to saner form The old form duplicated the last line of the processed file if the key was not present. This was not a problem before we added Unity-specific keys to the desktop files, because all keys were always present... Change-Id: Ifef6a90250fd303b913807944c7a23e04a5aafb1 --- sysui/desktop/share/translate.pl | 125 +++++++++++++++++++-------------------- 1 file changed, 62 insertions(+), 63 deletions(-) diff --git a/sysui/desktop/share/translate.pl b/sysui/desktop/share/translate.pl index 89c9da0db5ff..c55ee25131d4 100755 --- a/sysui/desktop/share/translate.pl +++ b/sysui/desktop/share/translate.pl @@ -29,15 +29,9 @@ eval 'exec perl -wS $0 ${1+"$@"}' # #************************************************************************* - -#********************************************************************* -# -# main -# - my ($prefix, $ext, $key); -$productname = "LibreOffice"; -$workdir = "."; +my $productname = "LibreOffice"; +my $workdir = "."; while ($_ = $ARGV[0], /^-/) { shift; @@ -65,63 +59,36 @@ while ($_ = $ARGV[0], /^-/) { } # hack for unity section -$outkey = $key; +my $outkey = $key; if ( $outkey eq "UnityQuicklist" ) { $outkey = "Name"; } +my %templates; + # open input file unless (open(SOURCE, $ARGV[0])) { print STDERR "Can't open $ARGV[0] file: $!\n"; return; } +# currently read template +my $template; -# For every section in the specified ulf file there should exist -# a template file in $workdir .. +# read ulf file while () { - $line = $_; + my $line = $_; if ( "[" eq substr($line, 0, 1) ) { - # Pass the tail of the template to the output file - while (