Browse Source

Remove all trailing whitespaces

master
Sébastien Lucas 8 years ago
parent
commit
d901887288
1 changed files with 14 additions and 14 deletions
  1. +14
    -14
      tools/updateLang.pl

+ 14
- 14
tools/updateLang.pl View File

@@ -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 = <INPUT>;
close INPUT;

$/ = $save;
return $content;
}



Loading…
Cancel
Save