Revision 6f73d970
Von Moritz Bunkus vor fast 19 Jahren hinzugefügt
locale/de/all | ||
---|---|---|
309 | 309 |
'Enforce transaction reversal for all dates' => 'Gegenbuchungen f?r jeden Zeitraum aktualisieren', |
310 | 310 |
'Enter up to 3 letters separated by a colon (i.e CAD:USD:EUR) for your native and foreign currencies' => 'Geben Sie Ihre und weitere W?hrungen mit bis zu drei Buchstaben pro W?hrung und W?hrungen durch Doppelpunkte getrennt ein (z.B. EUR:USD:CAD)', |
311 | 311 |
'Equity' => 'Passiva', |
312 |
'Error!' => 'Fehler!', |
|
312 | 313 |
'Exch' => 'Wechselkurs.', |
313 | 314 |
'Exchangerate' => 'Wechselkurs', |
314 | 315 |
'Exchangerate Difference' => 'Wechselkursunterschied', |
locale/de/locales.pl | ||
---|---|---|
2 | 2 |
|
3 | 3 |
# -n do not include custom_ scripts |
4 | 4 |
|
5 |
use POSIX; |
|
5 | 6 |
use FileHandle; |
6 | 7 |
|
7 | 8 |
$basedir = "../.."; |
... | ... | |
36 | 37 |
require "all"; |
37 | 38 |
} |
38 | 39 |
|
40 |
# Read HTML templates. |
|
41 |
%htmllocale = (); |
|
42 |
@htmltemplates = <../../templates/webpages/*/*_master.html>; |
|
43 |
foreach $file (@htmltemplates) { |
|
44 |
scanhtmlfile($file); |
|
45 |
} |
|
46 |
|
|
39 | 47 |
foreach $file (@progfiles) { |
40 | 48 |
|
41 | 49 |
%locale = (); |
... | ... | |
72 | 80 |
unlink 'missing'; |
73 | 81 |
|
74 | 82 |
foreach $text (keys %$missing) { |
75 |
if ($locale{$text}) { |
|
83 |
if ($locale{$text} || $htmllocale{$text}) {
|
|
76 | 84 |
unless ($self{texts}{$text}) { |
77 | 85 |
$self{texts}{$text} = $missing->{$text}; |
78 | 86 |
} |
... | ... | |
140 | 148 |
close FH; |
141 | 149 |
} |
142 | 150 |
|
151 |
foreach $file (@htmltemplates) { |
|
152 |
converthtmlfile($file); |
|
153 |
} |
|
154 |
|
|
143 | 155 |
# now print out all |
144 | 156 |
|
145 | 157 |
open FH, ">all" or die "$! : all"; |
... | ... | |
379 | 391 |
|
380 | 392 |
} |
381 | 393 |
|
394 |
sub scanhtmlfile { |
|
395 |
local *IN; |
|
396 |
|
|
397 |
open(IN, $_[0]) || die; |
|
398 |
|
|
399 |
my $copying = 0; |
|
400 |
my $text = ""; |
|
401 |
while (my $line = <IN>) { |
|
402 |
chomp($line); |
|
403 |
|
|
404 |
while ("" ne $line) { |
|
405 |
if (!$copying) { |
|
406 |
if ($line =~ m|<translate>|i) { |
|
407 |
substr($line, 0, $+[0]) = ""; |
|
408 |
$copying = 1; |
|
409 |
|
|
410 |
} else { |
|
411 |
$line = ""; |
|
412 |
} |
|
413 |
|
|
414 |
} else { |
|
415 |
if ($line =~ m|</translate>|i) { |
|
416 |
$text .= $`; |
|
417 |
substr($line, 0, $+[0]) = ""; |
|
418 |
$copying = 0; |
|
419 |
$alllocales{$text} = 1; |
|
420 |
$htmllocale{$text} = 1; |
|
421 |
$text = ""; |
|
422 |
|
|
423 |
} else { |
|
424 |
$text .= $line; |
|
425 |
$line = ""; |
|
426 |
} |
|
427 |
} |
|
428 |
} |
|
429 |
} |
|
430 |
|
|
431 |
close(IN); |
|
432 |
} |
|
433 |
|
|
434 |
sub converthtmlfile { |
|
435 |
local *IN; |
|
436 |
local *OUT; |
|
437 |
|
|
438 |
open(IN, $_[0]) || die; |
|
439 |
|
|
440 |
my $langcode = (split("/", getcwd()))[-1]; |
|
441 |
$_[0] =~ s/_master.html$/_${langcode}.html/; |
|
442 |
|
|
443 |
open(OUT, ">${_[0]}") || die; |
|
444 |
|
|
445 |
my $copying = 0; |
|
446 |
my $text = ""; |
|
447 |
while (my $line = <IN>) { |
|
448 |
chomp($line); |
|
449 |
if ("" eq $line) { |
|
450 |
print(OUT "\n"); |
|
451 |
next; |
|
452 |
} |
|
453 |
|
|
454 |
while ("" ne $line) { |
|
455 |
if (!$copying) { |
|
456 |
if ($line =~ m|<translate>|i) { |
|
457 |
print(OUT $`); |
|
458 |
substr($line, 0, $+[0]) = ""; |
|
459 |
$copying = 1; |
|
460 |
print(OUT "\n") if ("" eq $line); |
|
461 |
|
|
462 |
} else { |
|
463 |
print(OUT "${line}\n"); |
|
464 |
$line = ""; |
|
465 |
} |
|
466 |
|
|
467 |
} else { |
|
468 |
if ($line =~ m|</translate>|i) { |
|
469 |
$text .= $`; |
|
470 |
substr($line, 0, $+[0]) = ""; |
|
471 |
$copying = 0; |
|
472 |
$alllocales{$text} = 1; |
|
473 |
$htmllocale{$text} = 1; |
|
474 |
print(OUT $self{"texts"}{$text}); |
|
475 |
print(OUT "\n") if ("" eq $line); |
|
476 |
$text = ""; |
|
477 |
|
|
478 |
} else { |
|
479 |
$text .= $line; |
|
480 |
$line = ""; |
|
481 |
} |
|
482 |
} |
|
483 |
} |
|
484 |
} |
|
485 |
|
|
486 |
close(IN); |
|
487 |
close(OUT); |
|
488 |
} |
templates/webpages/generic/error.html | ||
---|---|---|
1 |
<body> |
|
2 |
<table width=100%> |
|
3 |
<tr> |
|
4 |
<th class=listtop><TMPL_VAR NAME=title DEFAULT="Error!"></th> |
|
5 |
</tr> |
|
6 |
<tr height="5"></tr> |
|
7 |
|
|
8 |
<tr><td><TMPL_VAR NAME=label_error></td></tr> |
|
9 |
</table> |
|
10 |
|
|
11 |
<TMPL_VAR NAME=DEBUG> |
|
12 |
|
|
13 |
</body> |
|
14 |
</html> |
templates/webpages/generic/error_master.html | ||
---|---|---|
1 |
<body> |
|
2 |
<table width=100%> |
|
3 |
<tr> |
|
4 |
<th class=listtop><TMPL_VAR NAME=title DEFAULT="<translate>Error!</translate>"></th> |
|
5 |
</tr> |
|
6 |
<tr height="5"></tr> |
|
7 |
|
|
8 |
<tr><td><TMPL_VAR NAME=label_error></td></tr> |
|
9 |
</table> |
|
10 |
|
|
11 |
<TMPL_VAR NAME=DEBUG> |
|
12 |
|
|
13 |
</body> |
|
14 |
</html> |
Auch abrufbar als: Unified diff
Die HTML-Vorlagen werden nun ebenfalls von locales.pl uebersetzt. Dabei werden alle Vorlagen mit name_master.html benannt und nach name_sprache.html ausgegeben. Der zu uebersetzende Text steht innerhalb von <translate>...</translate>. Diese Tags koennen an beliebigen Stellen vorkommen, also auch z.B. in Attributen von regulaeren HTML-Tags oder innerhalb von <TMPL ...>-Tags.