From: Thomas Heck Date: Mon, 4 Mar 2013 08:51:27 +0000 (+0100) Subject: Merge branch 'master' into dev X-Git-Tag: release-3.1.0beta1~554^2~1^2~4 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/87e65e6c1cc64bfb2d73b6914ed2ef136861dd42?ds=inline;hp=-c Merge branch 'master' into dev --- 87e65e6c1cc64bfb2d73b6914ed2ef136861dd42 diff --combined SL/Layout/None.pm index 25ea9161a,60b8512fe..cb3bdb91a --- a/SL/Layout/None.pm +++ b/SL/Layout/None.pm @@@ -3,6 -3,8 +3,8 @@@ package SL::Layout::None use strict; use parent qw(SL::Layout::Base); + use List::MoreUtils qw(apply); + sub javascripts_inline { _setup_formats(), _setup_focus(), @@@ -13,7 -15,6 +15,7 @@@ sub use_javascript qw( js/jquery.js js/common.js + js/namespace.js ), $self->SUPER::use_javascript(@_); } @@@ -28,7 -29,13 +30,13 @@@ sub use_stylesheet } sub _setup_formats { - $::form->parse_html_template('layout/javascript_setup') + my $datefmt = apply { + s/d+/dd/gi; + s/m+/mm/gi; + s/y+/yy/gi; + } $::myconfig{dateformat}; + + $::form->parse_html_template('layout/javascript_setup', { datefmt => $datefmt }); } sub _setup_focus { diff --combined scripts/locales.pl index 5807f4b26,baf0dc661..5e90423f4 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@@ -36,13 -36,12 +36,13 @@@ my @progdirs = ( "$basedir/SL" ) my $dbupdir = "$basedir/sql/Pg-upgrade"; my $dbupdir2 = "$basedir/sql/Pg-upgrade2"; my $menufile = "menu.ini"; +my @javascript_dirs = ($basedir .'/js', $basedir .'/templates/webpages'); my $submitsearch = qr/type\s*=\s*[\"\']?submit/i; our $self = {}; our $missing = {}; our @lost = (); -my (%referenced_html_files, %locale, %htmllocale, %alllocales, %cached, %submit); +my (%referenced_html_files, %locale, %htmllocale, %alllocales, %cached, %submit, %jslocale); my ($ALL_HEADER, $MISSING_HEADER, $LOST_HEADER); init(); @@@ -124,10 -123,6 +124,10 @@@ handle_file($_, $dbupdir) for @dbplfil handle_file($_, $dbupdir2) for @dbplfiles2; scanmenu($_) for @menufiles; +for my $file_name (map({find_files($_)} @javascript_dirs)) { + scan_javascript_file($file_name); +} + # merge entries to translate with entries from files 'missing' and 'lost' merge_texts(); @@@ -139,16 -134,6 +139,16 @@@ generate_file data_sub => sub { _print_line($_, $self->{texts}{$_}, @_) for sort keys %alllocales }, ); +open(my $js_file, '>:encoding(utf8)', $locales_dir .'/js.js') || die; +print $js_file '{'; +my $first_entry = 1; +for my $key (sort(keys(%jslocale))) { + print $js_file ((!$first_entry ? ',' : '') ."\n". _double_quote($key) .':'. _double_quote($self->{texts}{$key})); + $first_entry = 0; +} +print $js_file ("\n".'}'."\n"); +close($js_file); + foreach my $text (keys %$missing) { if ($locale{$text} || $htmllocale{$text}) { unless ($self->{texts}{$text}) { @@@ -407,7 -392,7 +407,7 @@@ sub scanfile while ($rc) { if (/Locale/) { unless (/^use /) { - my ($null, $country) = split /,/; + my ($null, $country) = split(/,/); $country =~ s/^ +[\"\']//; $country =~ s/[\"\'].*//; } @@@ -526,7 -511,7 +526,7 @@@ sub scanhtmlfile while ($line =~ m/\[\%[^\w]*(\w+)\.\w+\(/g) { my $plugin = $1; - $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript MultiColumnIterator JSON L P)); + $plugins{needed}->{$plugin} = 1 if (first { $_ eq $plugin } qw(HTML LxERP JavaScript JSON L P)); } $plugins{needed}->{T8} = 1 if $line =~ m/\[\%.*\|.*\$T8/; @@@ -601,31 -586,6 +601,31 @@@ $referenced_html_files{$_} = 1 for keys %{$cached{$file}{scanh}}; } +sub scan_javascript_file { + my ($file) = @_; + + open(my $fh, $file) || die('can not open file: '. $file); + + while( my $line = readline($fh) ) { + while( $line =~ m/ + kivi.t8 + \s* + \( + \s* + ([\'\"]) + (.*?) + (?