X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=scripts%2Flocales.pl;h=2c31f87b35647d9ba6314c9c5517f5dd7968799c;hb=3f924c0fc876c2133e5ba22f25a45a484885ee0b;hp=ec9624a60fad3360e780bcf7f9c5bc36a58b0653;hpb=b251cc22f355941217493073e124ba3878d5530f;p=kivitendo-erp.git diff --git a/scripts/locales.pl b/scripts/locales.pl index ec9624a60..2c31f87b3 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -27,6 +27,7 @@ use List::Util qw(first); use Pod::Usage; use YAML (); use YAML::Loader (); # YAML tries to load Y:L at runtime, but can't find it after we chdir'ed +use SL::DBUpgrade2; $OUTPUT_AUTOFLUSH = 1; @@ -43,7 +44,7 @@ my $basedir = "../.."; my $locales_dir = "."; my $bindir = "$basedir/bin/mozilla"; my @progdirs = ( "$basedir/SL" ); -my @menufiles = <"${basedir}/menus/*/*">; +my @menufiles = glob("${basedir}/menus/*/*"); my @javascript_dirs = ($basedir .'/js', $basedir .'/templates/webpages'); my $javascript_output_dir = $basedir .'/js'; my $submitsearch = qr/type\s*=\s*[\"\']?submit/i; @@ -125,6 +126,7 @@ my %old_texts = %{ $self->{texts} || {} }; handle_file(@{ $_ }) for @progfiles; handle_file(@{ $_ }) for @dbplfiles; scanmenu($_) for @menufiles; +scandbupgrades(); for my $file_name (grep { /\.(?:js|html)$/i } map({find_files($_)} @javascript_dirs)) { scan_javascript_file($file_name); @@ -515,12 +517,30 @@ sub scanfile { sub scanmenu { my $file = shift; - print STDERR "trying to load file $file\n"; my $menu = YAML::LoadFile($file); for my $node (@$menu) { + # possible for override files + next unless exists $node->{name}; + $locale{$node->{name}} = 1; $alllocales{$node->{name}} = 1; + $cached{$file}{all}{$node->{name}} = 1; + } +} + +sub scandbupgrades { + # we only need to do this for auth atm, because only auth scripts can include new rights, which are translateable + my $auth = 1; + + my $dbu = SL::DBUpgrade2->new(auth => $auth, path => '../../sql/Pg-upgrade2-auth'); + + for my $upgrade ($dbu->sort_dbupdate_controls) { + for my $string (@{ $upgrade->{locales} || [] }) { + $locale{$string} = 1; + $alllocales{$string} = 1; + $cached{$upgrade->{tag}}{all}{$string} = 1; + } } } @@ -595,7 +615,7 @@ sub scanhtmlfile { } while ($line =~ m/\[\% # Template-Start-Tag - [\-~#]? # Whitespace-Unterdrückung + [\-~#]* # Whitespace-Unterdrückung \s* # Optional beliebig viele Whitespace (?: # Die erkannten Template-Direktiven PROCESS