--- a/misc/translator/LangInstaller.pm +++ a/misc/translator/LangInstaller.pm @@ -75,8 +75,8 @@ sub new { # Get all available language codes opendir $fh, $self->{path_po}; - my @langs = map { ($_) =~ /(.*)-i-opac/ } - grep { $_ =~ /.*-opac-t-prog/ } readdir($fh); + my @langs = map { ($_) =~ /(.*)-pref/ } + grep { $_ =~ /.*-pref/ } readdir($fh); closedir $fh; $self->{langs} = \@langs; @@ -86,12 +86,12 @@ sub new { { name => 'OPAC prog', dir => "$opachtdocs/prog", - suffix => '-i-opac-t-prog-v-3006000.po', + suffix => '-opac-prog.po', }, { name => 'Intranet prog UI', dir => $context->config('intrahtdocs') . '/prog', - suffix => '-i-staff-t-prog-v-3006000.po', + suffix => '-staff-prog.po', }, { name => 'Intranet prog help', @@ -110,6 +110,20 @@ sub new { }; } + # MARC flavours (hardcoded list) + for ( "MARC21", "UNIMARC", "NORMARC" ) { + my $dirs = $context->config('intrahtdocs') . '/prog'; + opendir $fh, $context->config('opachtdocs'); + for ( grep { not /^\.|\.\.|lib$/ } readdir($fh) ) { + $dirs .= ' ' . "$opachtdocs/$_"; + } + push @{$self->{interface}}, { + name => "$_", + dir => $dirs, + suffix => "-marc-$_.po", + }; + } + bless $self, $class; } @@ -329,29 +343,37 @@ sub install_tmpl { my ($self, $files) = @_; say "Install templates" if $self->{verbose}; for my $trans ( @{$self->{interface}} ) { - print - " Install templates '$trans->{name}'\n", - " From: $trans->{dir}/en/\n", - " To : $trans->{dir}/$self->{lang}\n", - " With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" + my @t_dirs = split(" ", $trans->{dir}); + for my $t_dir ( @t_dirs ) { + print + " Install templates '$trans->{name}'\n", + " From: $t_dir/en/\n", + " To : $t_dir/$self->{lang}\n", + " With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" if $self->{verbose}; - my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; - my $lang_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/$self->{lang}"; - $lang_dir =~ s|/en/|/$self->{lang}/|; - mkdir $lang_dir unless -d $lang_dir; - my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; - - system - "$self->{process} install " . - "-i $trans_dir " . - "-o $lang_dir ". - "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . - ( - @$files - ? ' -f ' . join ' -f ', @$files - : '' - ) + my $trans_dir = ( $trans->{name} =~ /help/ )?"$t_dir":"$t_dir/en/"; + my $lang_dir = ( $trans->{name} =~ /help/ )?"$t_dir":"$t_dir/$self->{lang}"; + $lang_dir =~ s|/en/|/$self->{lang}/|; + mkdir $lang_dir unless -d $lang_dir; + my $excludes = ( $trans->{name} !~ /help/ )?"":"-x 'help'"; + my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations + my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants + + system + "$self->{process} install " . + "-i $trans_dir " . + "-o $lang_dir ". + "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . + "$excludes " . + "$match " . + "$nomatch " . + ( + @$files + ? ' -f ' . join ' -f ', @$files + : '' + ) + } } } @@ -366,16 +388,21 @@ sub update_tmpl { " From: $trans->{dir}/en/\n", " To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" if $self->{verbose}; - my $lang_dir = "$trans->{dir}/$self->{lang}"; - mkdir $lang_dir unless -d $lang_dir; my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; - my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; + my $excludes = ( $trans->{name} !~ /help/ )?"":"-x 'help'"; + my $dirs = join(" -i ",split(" ",$trans->{dir})); # multiple source dirs + my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations + my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants + system "$self->{process} update " . - "-i $trans_dir " . - "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . + "-i $dirs " . + "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . + "$excludes " . + "$match " . + "$nomatch " . ( @$files ? ' -f ' . join ' -f ', @$files @@ -409,12 +436,18 @@ sub create_tmpl { if $self->{verbose}; my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; - my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; + my $excludes = ( $trans->{name} !~ /help/ )?"":"-x 'help'"; + my $dirs = join(" -i ",split(" ",$trans->{dir})); # multiple source dirs + my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations + my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants system "$self->{process} create " . - "-i $trans_dir " . - "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . + "-i $dirs " . + "-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . + "$excludes " . + "$match " . + "$nomatch " . ( @$files ? ' -f ' . join ' -f ', @$files @@ -504,17 +537,21 @@ appropriate directory. =item translate create F -Create 3 .po files in F subdirectory: (1) from opac pages templates, (2) -intranet templates, and (3) from preferences. +Create 4 kinds of .po files in F subdirectory: +(1) one from each theme on opac pages templates, +(2) intranet templates and help, +(3) preferences, and +(4) one for each MARC dialect. + =over -=item F-opac.po +=item F-opac-{theme}.po Contains extracted text from english (en) OPAC templates found in -/koha-tmpl/opac-tmpl/prog/en/ directory. +/koha-tmpl/opac-tmpl/{theme}/en/ directory. -=item F-intranet.po +=item F-staff-prog.po and F-staff-help.po Contains extracted text from english (en) intranet templates found in /koha-tmpl/intranet-tmpl/prog/en/ directory. @@ -525,6 +562,11 @@ Contains extracted text from english (en) preferences. They are found in files located in /koha-tmpl/intranet-tmpl/prog/en/admin/preferences directory. +=item F-marc-{MARC}.po + +Contains extracted text from english (en) files from opac and intranet, +related with MARC dialects. + =back =item pref-trans update F --