diff -urN smeserver-manager-0.1.2.old/root/etc/e-smith/events/actions/locales2-conf smeserver-manager-0.1.2/root/etc/e-smith/events/actions/locales2-conf --- smeserver-manager-0.1.2.old/root/etc/e-smith/events/actions/locales2-conf 2021-01-07 20:39:03.000000000 +0400 +++ smeserver-manager-0.1.2/root/etc/e-smith/events/actions/locales2-conf 2021-01-13 18:47:42.218000000 +0400 @@ -21,6 +21,8 @@ package esmith; use strict; +use constant DEBUG => 0; + use constant I18NMODULES => '/usr/share/smanager/lib/SrvMngr/I18N/Modules'; #------------------------- @@ -38,7 +40,7 @@ # get lexicons list #------------------------- opendir DIR, I18NMODULES . "/$module" or die "Couldn't open ", I18NMODULES, "\n"; - my @lexs = grep (/_..\.lex$/, readdir (DIR)); + my @lexs = grep (/_.*\.lex$/, readdir (DIR)); closedir DIR; foreach my $lex (@lexs) { @@ -55,6 +57,7 @@ next if ( $mod ne lc($module) ); + $lang =~ s/-/_/; my $long_pm = I18NMODULES . "/$module/$lang". '.pm'; if ( -f $long_pm ) { # .pm file not newer than .lex @@ -89,7 +92,7 @@ # eval and restore if NOT OK #------------------------- if ( eval "use lib '".I18NMODULES."/../../../'; require '$long_pm';" ) { - print "Lexicon $lang for $module ($lex) written to ${lang}.pm\n"; + print "Lexicon $lang for $module ($lex) written to ${lang}.pm\n" if DEBUG; if ( -f ${long_pm}.'.svg' ) { print "locales2: error rm" unless system("rm -f ${long_pm}.svg") == 0; } diff -urN smeserver-manager-0.1.2.old/root/etc/e-smith/events/actions/navigation2-conf smeserver-manager-0.1.2/root/etc/e-smith/events/actions/navigation2-conf --- smeserver-manager-0.1.2.old/root/etc/e-smith/events/actions/navigation2-conf 2020-11-19 11:53:26.000000000 +0400 +++ smeserver-manager-0.1.2/root/etc/e-smith/events/actions/navigation2-conf 2021-01-13 23:47:36.752000000 +0400 @@ -19,87 +19,93 @@ # #---------------------------------------------------------------------- package esmith; - use strict; +use constant SMNGR_LIB => '/usr/share/smanager/lib'; +use constant I18NMODULES => 'SrvMngr/I18N/Modules'; +use constant WEBFUNCTIONS => 'SrvMngr/Controller'; +use constant NAVDIR => '/home/e-smith/db'; +use constant NAVIGATIONDIR => 'navigation2'; +use constant DEBUG => 0; + use esmith::NavigationDB; use esmith::I18N; -use constant WEBFUNCTIONS => '/usr/share/smanager/lib/SrvMngr/Controller'; -use constant NAVIGATIONDIR => '/home/e-smith/db/navigation2'; -use constant NEW_NAVDIR => '/home/e-smith/db'; +#use Data::Dumper; my $navigation_ignore = - "(\.\.?|navigation|noframes|online-manual|(internal|pleasewait)(-.*)?)"; + "(\.\.?|Swttheme\.pm|Login\.pm|Request\.pm|Modules\.pm(-.*)?)"; my $i18n = new esmith::I18N; my %navdbs; -opendir FUNCTIONS, WEBFUNCTIONS or - die "Couldn't open ", WEBFUNCTIONS, "\n"; - +opendir FUNCTIONS, SMNGR_LIB.'/'.WEBFUNCTIONS or + die "Couldn't open ", SMNGR_LIB.'/'.WEBFUNCTIONS, "\n"; my @files = grep (!/^${navigation_ignore}$/, readdir (FUNCTIONS)); - closedir FUNCTIONS; my @langs = $i18n->availableLanguages(); +#my @langs = ('en', 'fr'); +#print Dumper(\@langs); -use XML::Parser; -my $parser = new XML::Parser (Style => 'Tree', - ProtocolEncoding => 'UTF-8'); -foreach my $file (@files) +foreach my $lang (@langs) { - next if (-d WEBFUNCTIONS . "/$file"); - next unless ( $file =~ m/[A-Z].*\.pm$/ ); - - my $file2 = lc($file); - $file2 =~ s/\.pm$//; + my $long_lex = SMNGR_LIB.'/'.I18NMODULES."/General/general_$lang.lex"; + next unless ( -e $long_lex ); - #-------------------------------------------------- - # extract heading, description and weight information - # from CGI script - #-------------------------------------------------- - open(SCRIPT, WEBFUNCTIONS . "/$file"); - my $heading = undef; - my $description = undef; - my $heading_weight = undef; - my $description_weight = undef; - my $menucat = undef; - my $routes = undef; + open(LEX, '<:encoding(UTF-8)', $long_lex) + or die "Couldn't open ", $long_lex, " for reading.\n"; + my @gen_lex = ; + close LEX; - while (