X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=locale%2Fde%2Flocales.pl;h=ac2494758bb7063b95e7df8fc4bc9d7853c7d1a4;hb=22ac8f4a3d23f7014fdc28ef50decd1026acbd5e;hp=9e132c99b23ca373661f0698c26082e20fd82263;hpb=3810590867a59bab1a4b65d9b4ae67b19038fd19;p=kivitendo-erp.git diff --git a/locale/de/locales.pl b/locale/de/locales.pl index 9e132c99b..ac2494758 100755 --- a/locale/de/locales.pl +++ b/locale/de/locales.pl @@ -2,6 +2,7 @@ # -n do not include custom_ scripts +use POSIX; use FileHandle; $basedir = "../.."; @@ -36,6 +37,13 @@ if (-f 'all') { require "all"; } +# Read HTML templates. +%htmllocale = (); +@htmltemplates = <../../templates/webpages/*/*_master.html>; +foreach $file (@htmltemplates) { + scanhtmlfile($file); +} + foreach $file (@progfiles) { %locale = (); @@ -59,14 +67,20 @@ foreach $file (@progfiles) { &scanmenu("$basedir/$item"); } } - + + if ($file eq 'menunew.pl') { + foreach $item (@menufiles) { + &scanmenu("$basedir/$item"); + } + } + $file =~ s/\.pl//; eval { require 'missing'; }; unlink 'missing'; foreach $text (keys %$missing) { - if ($locale{$text}) { + if ($locale{$text} || $htmllocale{$text}) { unless ($self{texts}{$text}) { $self{texts}{$text} = $missing->{$text}; } @@ -134,6 +148,10 @@ $self{subs} = { close FH; } +foreach $file (@htmltemplates) { + converthtmlfile($file); +} + # now print out all open FH, ">all" or die "$! : all"; @@ -373,3 +391,98 @@ sub scanmenu { } +sub scanhtmlfile { + local *IN; + + open(IN, $_[0]) || die; + + my $copying = 0; + my $text = ""; + while (my $line = ) { + chomp($line); + + while ("" ne $line) { + if (!$copying) { + if ($line =~ m||i) { + substr($line, 0, $+[0]) = ""; + $copying = 1; + + } else { + $line = ""; + } + + } else { + if ($line =~ m||i) { + $text .= $`; + substr($line, 0, $+[0]) = ""; + $copying = 0; + $alllocales{$text} = 1; + $htmllocale{$text} = 1; + $text = ""; + + } else { + $text .= $line; + $line = ""; + } + } + } + } + + close(IN); +} + +sub converthtmlfile { + local *IN; + local *OUT; + + open(IN, $_[0]) || die; + + my $langcode = (split("/", getcwd()))[-1]; + $_[0] =~ s/_master.html$/_${langcode}.html/; + + open(OUT, ">${_[0]}") || die; + + my $copying = 0; + my $text = ""; + while (my $line = ) { + chomp($line); + if ("" eq $line) { + print(OUT "\n"); + next; + } + + while ("" ne $line) { + if (!$copying) { + if ($line =~ m||i) { + print(OUT $`); + substr($line, 0, $+[0]) = ""; + $copying = 1; + print(OUT "\n") if ("" eq $line); + + } else { + print(OUT "${line}\n"); + $line = ""; + } + + } else { + if ($line =~ m||i) { + $text .= $`; + substr($line, 0, $+[0]) = ""; + $copying = 0; + $alllocales{$text} = 1; + $htmllocale{$text} = 1; + print(OUT $self{"texts"}{$text}); + print(OUT "\n") if ("" eq $line); + $text = ""; + + } else { + $text .= $line; + $line = ""; + } + } + } + } + + close(IN); + close(OUT); +}