From eaf611143d8584711b75af365a1d15c105beb7a7 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 22 Sep 2005 14:18:22 +0000 Subject: [PATCH] Probleme durch perltidy. Der sehr pingelige Parser von locales.pl akzeptiert Begriffe fuer Funktionen, die in einem Formular mit genannt werden, nur dann, wenn das $locale->text() in der gleichen Zeile wie type=submit steht. Dieses habe ich geaendert. Weitere Probleme gab es, wenn perltidy bei sehr langen Strings zu $locale->text() den sehr langen Text in eine eigene Zeile gepackt hat, weil auch hier locales.pl den zu uebersetzenden Text direkt hinter $locale->text( erwartet. --- bin/mozilla/admin.pl | 15 ++++----------- bin/mozilla/am.pl | 4 +--- bin/mozilla/bp.pl | 3 +-- bin/mozilla/licenses.pl | 6 ++---- bin/mozilla/ustva.pl | 7 ++----- locale/de/locales.pl | 35 +++++++++++++++++++++++++++++------ locale/de/rp | 1 + 7 files changed, 40 insertions(+), 31 deletions(-) diff --git a/bin/mozilla/admin.pl b/bin/mozilla/admin.pl index 566f29ac2..c1fbb7c6c 100644 --- a/bin/mozilla/admin.pl +++ b/bin/mozilla/admin.pl @@ -344,9 +344,7 @@ $nologin | . $locale->text('Click on login name to edit!') . qq|
| - . $locale->text( - 'To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.' - ) + . $locale->text('To add a user to a group edit a name, change the login name and save. A new user with the same variables will then be saved under the new login name.') . qq|

@@ -1195,12 +1193,9 @@ sub dbselect_source { &dbdriver_defaults; $msg{Pg} = - $locale->text( - 'Leave host and port field empty unless you want to make a remote connection.' - ); + $locale->text('Leave host and port field empty unless you want to make a remote connection.'); $msg{Oracle} = - $locale->text( - 'You must enter a host and port for local and remote connections!'); + $locale->text('You must enter a host and port for local and remote connections!'); $form->{title} = "Lx-Office ERP / " . $locale->text('Database Administration'); @@ -1280,9 +1275,7 @@ sub dbselect_source {

| - . $locale->text( - 'This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!' - ) + . $locale->text('This is a preliminary check for existing sources. Nothing will be created or deleted at this stage!') . qq|
$msg{$form->{dbdriver}} diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 20f1ad8d3..ced3b0814 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1759,9 +1759,7 @@ sub config { | - . $locale->text( - 'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' - ) + . $locale->text('Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies') . qq|
diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl index 99f2a0416..93789019e 100644 --- a/bin/mozilla/bp.pl +++ b/bin/mozilla/bp.pl @@ -281,8 +281,7 @@ sub remove {

$form->{title}

| - . $locale->text( - 'Are you sure you want to remove the marked entries from the queue?') + . $locale->text('Are you sure you want to remove the marked entries from the queue?') . qq|

| - . $locale->text( - "No licenses were found that match the search criteria.") + . $locale->text("No licenses were found that match the search criteria.") . qq||); exit(0); } diff --git a/bin/mozilla/ustva.pl b/bin/mozilla/ustva.pl index 1bab65166..248af2b8f 100644 --- a/bin/mozilla/ustva.pl +++ b/bin/mozilla/ustva.pl @@ -236,8 +236,7 @@ sub report { $checked = "checked" if ($form->{kz10} eq '1'); print qq| | . $locale->text('Berichtigte Anmeldung') . qq|
@@ -1228,9 +1227,7 @@ sub edit_form { # Auf Übergabefehler checken USTVA::info( - $locale->text( - 'Bitte das Bundesland UND die Stadt bzw. den Einzugsbereich Ihres zuständigen Finanzamts auswählen.' - )) + $locale->text('Bitte das Bundesland UND die Stadt bzw. den Einzugsbereich Ihres zuständigen Finanzamts auswählen.')) if ( $form->{elsterFFFF_new} eq 'Auswahl' || $form->{elsterland_new} eq 'Auswahl'); USTVA::info( diff --git a/locale/de/locales.pl b/locale/de/locales.pl index a358a905e..8981e5aeb 100755 --- a/locale/de/locales.pl +++ b/locale/de/locales.pl @@ -218,7 +218,10 @@ sub scanfile { my $fh = new FileHandle; open $fh, "$file" or die "$! : $file"; + my ($is_submit, $line_no, $sub_line_no) = (0, 0, 0); + while (<$fh>) { + $line_no++; # is this another file if (/require\s+\W.*\.pl/) { my $newfile = $&; @@ -240,14 +243,27 @@ sub scanfile { if (/Locale/) { unless (/^use /) { my ($null, $country) = split /,/; - $country =~ s/^ +["']//; - $country =~ s/["'].*//; + $country =~ s/^ +[\"\']//; + $country =~ s/[\"\'].*//; } } - if (/\$locale->text.*?\W\)/) { + my $postmatch = ""; + # is it a submit button before $locale-> + if (/type\s*=\s*submit/i) { + $postmatch = $'; + if ($` !~ /\$locale->text/) { + $is_submit = 1; + $sub_line_no = $line_no; + } + } + + my ($found) = /\$locale->text.*?\W\)/; + my $postmatch = $'; + + if ($found) { my $string = $&; - $string =~ s/\$locale->text\(\s*['"(q|qq)]['\/\\\|~]*//; + $string =~ s/\$locale->text\(\s*[\'\"(q|qq)][\'\/\\\|~]*//; $string =~ s/\W\)+.*$//; # if there is no $ in the string record it @@ -259,16 +275,23 @@ sub scanfile { $alllocales{$string} = 1; # is it a submit button before $locale-> - if (/type=submit/) { + if ($is_submit) { $submit{$string} = 1; } } + } elsif ($postmatch =~ />/) { + $is_submit = 0; } # exit loop if there are no more locales on this line - ($rc) = ($' =~ /\$locale->text/); + ($rc) = ($postmatch =~ /\$locale->text/); # strip text s/^.*?\$locale->text.*?\)//; + + if (($postmatch =~ />/) || + (!$found && ($sub_line_no != $line_no) && />/)) { + $is_submit = 0; + } } } diff --git a/locale/de/rp b/locale/de/rp index 2680f6cc0..664fbbf72 100644 --- a/locale/de/rp +++ b/locale/de/rp @@ -170,6 +170,7 @@ $self{subs} = { 'alle_auswählen' => 'select_all', 'konfiguration' => 'config', 'debug' => 'debug', + 'winston_export' => 'winston_export', }; 1; -- 2.20.1