From d9018872880dde029d3557f838e48fba2bda325d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Lucas?= Date: Tue, 3 Nov 2015 14:38:21 +0100 Subject: [PATCH] Remove all trailing whitespaces --- tools/updateLang.pl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/updateLang.pl b/tools/updateLang.pl index db4a575..faef9cc 100644 --- a/tools/updateLang.pl +++ b/tools/updateLang.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Program : COPS localization string generator +# Program : COPS localization string generator # Version : 0.0.1 # # Author : Sébastien Lucas @@ -20,16 +20,16 @@ for (readdir ($dirhandle)) { next if (-d $_ ); # skip directories next if (/^[.]/); # skip dot-files next if not (/(.+)[.]php$/); - + my $file = "../" . $_; debug ("text file: " . $_ . "\n"); my $content = loadFile ($file); - + while ($content =~ /localize\s*\("([\w\.]*?)"\)/igs) { $allstrings{$1} = ""; debug (" * $1 \n"); } - + while ($content =~ /localize\s*\("([\w\.]*?)"\s*,/igs) { $allstrings{$1 . ".none"} = ""; $allstrings{$1 . ".one"} = ""; @@ -51,7 +51,7 @@ for (readdir ($dirhandle)) { next if (/^[.]/); # skip dot-files next if not (/(.+)[.]json$/); next if (/en\.json$/); - + handleLanguageFile ($_); } closedir $dirhandle; @@ -59,14 +59,14 @@ closedir $dirhandle; sub handleLanguageFile { my ($file) = @_; (my $lang = $file) =~ s/Localization_(\w\w)\.json/$1/; - my $file = "../lang/" . $file; + my $file = "../lang/" . $file; my $total = 0; my $translated = 0; - + debug ("language file: $file / $lang \n"); - + my $content = loadFile ($file); - + while ($content =~ /"(.*?)"\:\s*"(.*?)",/igs) { my $key = $1; my $value = $2; @@ -77,9 +77,9 @@ sub handleLanguageFile { $values{$lang}{$key} = $value; #debug (" * $1 \n"); } - + open OUTPUT, ">$file"; - + print OUTPUT "{\n"; foreach my $name (@strings) { $total++ if ($name !~ /^languages\.\w{3}$/); @@ -94,7 +94,7 @@ sub handleLanguageFile { debug (" $translated / $total ($percentage %) \n"); print OUTPUT "\"DO_NOT_TRANSLATE\":\"end\"\n"; print OUTPUT "}\n"; - + close OUTPUT; } @@ -102,13 +102,13 @@ sub loadFile { my ($file) = @_; my $save = $/; $/ = undef; - + open INPUT, "<$file"; my $content = ; close INPUT; $/ = $save; - + return $content; }