Revision af85b761
Von Moritz Bunkus vor fast 19 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
415 | 415 |
$main::lxdebug->enter_sub(); |
416 | 416 |
|
417 | 417 |
my ($self, $file, $additional_params) = @_; |
418 |
my $language; |
|
418 | 419 |
|
419 |
if (-f "templates/webpages/${file}_" . $main::myconfig{"countrycode"} . |
|
420 |
".html") { |
|
420 |
if (!defined($main::myconfig) || !defined($main::myconfig{"countrycode"})) { |
|
421 |
$language = $main::language; |
|
422 |
} else { |
|
423 |
$language = $main::myconfig{"countrycode"}; |
|
424 |
} |
|
425 |
|
|
426 |
if (-f "templates/webpages/${file}_${language}.html") { |
|
421 | 427 |
if ((-f ".developer") && |
422 | 428 |
(-f "templates/webpages/${file}_master.html") && |
423 | 429 |
((stat("templates/webpages/${file}_master.html"))[9] > |
424 |
(stat("templates/webpages/${file}_" . $main::myconfig{"countrycode"} . |
|
425 |
".html"))[9])) { |
|
430 |
(stat("templates/webpages/${file}_${language}.html"))[9])) { |
|
426 | 431 |
my $info = "Developper information: templates/webpages/${file}_master.html is newer than the localized version.\n" . |
427 |
"Please re-run 'locales.pl' in 'locale/" . $main::myconfig{"countrycode"} . "'.";
|
|
432 |
"Please re-run 'locales.pl' in 'locale/${language}'.";
|
|
428 | 433 |
print(qq|<pre>$info</pre>|); |
429 | 434 |
die($info); |
430 | 435 |
} |
431 | 436 |
|
432 |
$file = "templates/webpages/${file}_" . $main::myconfig{"countrycode"} . |
|
433 |
".html"; |
|
437 |
$file = "templates/webpages/${file}_${language}.html"; |
|
434 | 438 |
} elsif (-f "templates/webpages/${file}.html") { |
435 | 439 |
$file = "templates/webpages/${file}.html"; |
436 | 440 |
} else { |
437 | 441 |
my $info = "Web page template '${file}' not found.\n" . |
438 |
"Please re-run 'locales.pl' in 'locale/" . $main::myconfig{"countrycode"} . "'.";
|
|
442 |
"Please re-run 'locales.pl' in 'locale/${language}'.";
|
|
439 | 443 |
print(qq|<pre>$info</pre>|); |
440 | 444 |
die($info); |
441 | 445 |
} |
Auch abrufbar als: Unified diff
Wenn $main::myconfig noch nicht verfuegbar ist (z.B. beim Datenbankupgrade direkt nach der Anmeldung), dann muss die Sprache fuer die HTML-Vorlagen aus der globalen Variablen $language geholt werden, die in lx-erp.conf definiert wird.