|
Lines 75-82
sub new {
Link Here
|
| 75 |
|
75 |
|
| 76 |
# Get all available language codes |
76 |
# Get all available language codes |
| 77 |
opendir $fh, $self->{path_po}; |
77 |
opendir $fh, $self->{path_po}; |
| 78 |
my @langs = map { ($_) =~ /(.*)-i-opac/ } |
78 |
my @langs = map { ($_) =~ /(.*)-pref/ } |
| 79 |
grep { $_ =~ /.*-opac-t-prog/ } readdir($fh); |
79 |
grep { $_ =~ /.*-pref/ } readdir($fh); |
| 80 |
closedir $fh; |
80 |
closedir $fh; |
| 81 |
$self->{langs} = \@langs; |
81 |
$self->{langs} = \@langs; |
| 82 |
|
82 |
|
|
Lines 86-97
sub new {
Link Here
|
| 86 |
{ |
86 |
{ |
| 87 |
name => 'OPAC prog', |
87 |
name => 'OPAC prog', |
| 88 |
dir => "$opachtdocs/prog", |
88 |
dir => "$opachtdocs/prog", |
| 89 |
suffix => '-i-opac-t-prog-v-3006000.po', |
89 |
suffix => '-opac-prog.po', |
| 90 |
}, |
90 |
}, |
| 91 |
{ |
91 |
{ |
| 92 |
name => 'Intranet prog UI', |
92 |
name => 'Intranet prog UI', |
| 93 |
dir => $context->config('intrahtdocs') . '/prog', |
93 |
dir => $context->config('intrahtdocs') . '/prog', |
| 94 |
suffix => '-i-staff-t-prog-v-3006000.po', |
94 |
suffix => '-staff-prog.po', |
| 95 |
}, |
95 |
}, |
| 96 |
{ |
96 |
{ |
| 97 |
name => 'Intranet prog help', |
97 |
name => 'Intranet prog help', |
|
Lines 110-115
sub new {
Link Here
|
| 110 |
}; |
110 |
}; |
| 111 |
} |
111 |
} |
| 112 |
|
112 |
|
|
|
113 |
# MARC flavours (hardcoded) |
| 114 |
for ( "MARC21", "UNIMARC", "NORMARC" ) { |
| 115 |
my $dirs = $context->config('intrahtdocs') . '/prog'; |
| 116 |
opendir $fh, $context->config('opachtdocs'); |
| 117 |
for ( grep { not /^\.|\.\.|lib$/ } readdir($fh) ) { |
| 118 |
$dirs .= ' ' . "$opachtdocs/$_"; |
| 119 |
} |
| 120 |
push @{$self->{interface}}, { |
| 121 |
name => "$_", |
| 122 |
dir => $dirs, |
| 123 |
suffix => "-marc-$_.po", |
| 124 |
}; |
| 125 |
} |
| 126 |
|
| 113 |
bless $self, $class; |
127 |
bless $self, $class; |
| 114 |
} |
128 |
} |
| 115 |
|
129 |
|
|
Lines 329-357
sub install_tmpl {
Link Here
|
| 329 |
my ($self, $files) = @_; |
343 |
my ($self, $files) = @_; |
| 330 |
say "Install templates" if $self->{verbose}; |
344 |
say "Install templates" if $self->{verbose}; |
| 331 |
for my $trans ( @{$self->{interface}} ) { |
345 |
for my $trans ( @{$self->{interface}} ) { |
|
|
346 |
my @t_dirs = split(" ", $trans->{dir}); |
| 347 |
for my $t_dir ( @t_dirs ) { |
| 332 |
print |
348 |
print |
| 333 |
" Install templates '$trans->{name}'\n", |
349 |
" Install templates '$trans->{name}'\n", |
| 334 |
" From: $trans->{dir}/en/\n", |
350 |
" From: $t_dir/en/\n", |
| 335 |
" To : $trans->{dir}/$self->{lang}\n", |
351 |
" To : $t_dir/$self->{lang}\n", |
| 336 |
" With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
352 |
" With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
| 337 |
if $self->{verbose}; |
353 |
if $self->{verbose}; |
| 338 |
|
354 |
|
| 339 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
355 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$t_dir":"$t_dir/en/"; |
| 340 |
my $lang_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/$self->{lang}"; |
356 |
my $lang_dir = ( $trans->{name} =~ /help/ )?"$t_dir":"$t_dir/$self->{lang}"; |
| 341 |
$lang_dir =~ s|/en/|/$self->{lang}/|; |
357 |
$lang_dir =~ s|/en/|/$self->{lang}/|; |
| 342 |
mkdir $lang_dir unless -d $lang_dir; |
358 |
mkdir $lang_dir unless -d $lang_dir; |
| 343 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
359 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
|
|
360 |
my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations |
| 361 |
my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants |
| 344 |
|
362 |
|
| 345 |
system |
363 |
system |
| 346 |
"$self->{process} install " . |
364 |
"$self->{process} install " . |
| 347 |
"-i $trans_dir " . |
365 |
"-i $trans_dir " . |
| 348 |
"-o $lang_dir ". |
366 |
"-o $lang_dir ". |
| 349 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
367 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
|
|
368 |
"$excludes " . |
| 369 |
"$match " . |
| 370 |
"$nomatch " . |
| 350 |
( |
371 |
( |
| 351 |
@$files |
372 |
@$files |
| 352 |
? ' -f ' . join ' -f ', @$files |
373 |
? ' -f ' . join ' -f ', @$files |
| 353 |
: '' |
374 |
: '' |
| 354 |
) |
375 |
) |
|
|
376 |
} |
| 355 |
} |
377 |
} |
| 356 |
} |
378 |
} |
| 357 |
|
379 |
|
|
Lines 371-381
sub update_tmpl {
Link Here
|
| 371 |
|
393 |
|
| 372 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
394 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
| 373 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
395 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
|
|
396 |
my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations |
| 397 |
my $dirs = ( $trans->{name} =~ /MARC/ )?"-d ".join(" -d ",split(" ",$trans->{dir})):""; # for MARC translations; |
| 398 |
my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants |
| 399 |
|
| 374 |
|
400 |
|
| 375 |
system |
401 |
system |
| 376 |
"$self->{process} update " . |
402 |
"$self->{process} update " . |
| 377 |
"-i $trans_dir " . |
403 |
"-i $trans_dir " . |
| 378 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
404 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
|
|
405 |
"$excludes " . |
| 406 |
"$dirs " . |
| 407 |
"$match " . |
| 408 |
"$nomatch " . |
| 379 |
( |
409 |
( |
| 380 |
@$files |
410 |
@$files |
| 381 |
? ' -f ' . join ' -f ', @$files |
411 |
? ' -f ' . join ' -f ', @$files |
|
Lines 410-420
sub create_tmpl {
Link Here
|
| 410 |
|
440 |
|
| 411 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
441 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
| 412 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
442 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
|
|
443 |
my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations |
| 444 |
my $dirs = ( $trans->{name} =~ /MARC/ )?"-d ".join(" -d ",split(" ",$trans->{dir})):""; # for MARC translations; |
| 445 |
my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants |
| 413 |
|
446 |
|
| 414 |
system |
447 |
system |
| 415 |
"$self->{process} create " . |
448 |
"$self->{process} create " . |
| 416 |
"-i $trans_dir " . |
449 |
"-i $trans_dir " . |
| 417 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
450 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
|
|
451 |
"$excludes " . |
| 452 |
"$dirs " . |
| 453 |
"$match " . |
| 454 |
"$nomatch " . |
| 418 |
( |
455 |
( |
| 419 |
@$files |
456 |
@$files |
| 420 |
? ' -f ' . join ' -f ', @$files |
457 |
? ' -f ' . join ' -f ', @$files |