|
Lines 84-91
sub new {
Link Here
|
| 84 |
|
84 |
|
| 85 |
# Get all available language codes |
85 |
# Get all available language codes |
| 86 |
opendir $fh, $self->{path_po}; |
86 |
opendir $fh, $self->{path_po}; |
| 87 |
my @langs = map { ($_) =~ /(.*)-i-opac/ } |
87 |
my @langs = map { ($_) =~ /(.*)-pref/ } |
| 88 |
grep { $_ =~ /.*-opac-t-prog/ } readdir($fh); |
88 |
grep { $_ =~ /.*-pref/ } readdir($fh); |
| 89 |
closedir $fh; |
89 |
closedir $fh; |
| 90 |
$self->{langs} = \@langs; |
90 |
$self->{langs} = \@langs; |
| 91 |
|
91 |
|
|
Lines 95-106
sub new {
Link Here
|
| 95 |
{ |
95 |
{ |
| 96 |
name => 'OPAC prog', |
96 |
name => 'OPAC prog', |
| 97 |
dir => "$opachtdocs/prog", |
97 |
dir => "$opachtdocs/prog", |
| 98 |
suffix => '-i-opac-t-prog-v-3006000.po', |
98 |
suffix => '-opac-prog.po', |
| 99 |
}, |
99 |
}, |
| 100 |
{ |
100 |
{ |
| 101 |
name => 'Intranet prog UI', |
101 |
name => 'Intranet prog UI', |
| 102 |
dir => $context->config('intrahtdocs') . '/prog', |
102 |
dir => $context->config('intrahtdocs') . '/prog', |
| 103 |
suffix => '-i-staff-t-prog-v-3006000.po', |
103 |
suffix => '-staff-prog.po', |
| 104 |
}, |
104 |
}, |
| 105 |
{ |
105 |
{ |
| 106 |
name => 'Intranet prog help', |
106 |
name => 'Intranet prog help', |
|
Lines 119-124
sub new {
Link Here
|
| 119 |
}; |
119 |
}; |
| 120 |
} |
120 |
} |
| 121 |
|
121 |
|
|
|
122 |
# MARC flavours (hardcoded list) |
| 123 |
for ( "MARC21", "UNIMARC", "NORMARC" ) { |
| 124 |
my $dirs = $context->config('intrahtdocs') . '/prog'; |
| 125 |
opendir $fh, $context->config('opachtdocs'); |
| 126 |
for ( grep { not /^\.|\.\.|lib$/ } readdir($fh) ) { |
| 127 |
$dirs .= ' ' . "$opachtdocs/$_"; |
| 128 |
} |
| 129 |
push @{$self->{interface}}, { |
| 130 |
name => "$_", |
| 131 |
dir => $dirs, |
| 132 |
suffix => "-marc-$_.po", |
| 133 |
}; |
| 134 |
} |
| 135 |
|
| 122 |
bless $self, $class; |
136 |
bless $self, $class; |
| 123 |
} |
137 |
} |
| 124 |
|
138 |
|
|
Lines 338-366
sub install_tmpl {
Link Here
|
| 338 |
my ($self, $files) = @_; |
352 |
my ($self, $files) = @_; |
| 339 |
say "Install templates" if $self->{verbose}; |
353 |
say "Install templates" if $self->{verbose}; |
| 340 |
for my $trans ( @{$self->{interface}} ) { |
354 |
for my $trans ( @{$self->{interface}} ) { |
| 341 |
print |
355 |
my @t_dirs = split(" ", $trans->{dir}); |
| 342 |
" Install templates '$trans->{name}'\n", |
356 |
for my $t_dir ( @t_dirs ) { |
| 343 |
" From: $trans->{dir}/en/\n", |
357 |
my @files = @$files; |
| 344 |
" To : $trans->{dir}/$self->{lang}\n", |
358 |
my @nofiles = (); |
| 345 |
" With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
359 |
print |
|
|
360 |
" Install templates '$trans->{name}'\n", |
| 361 |
" From: $t_dir/en/\n", |
| 362 |
" To : $t_dir/$self->{lang}\n", |
| 363 |
" With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
| 346 |
if $self->{verbose}; |
364 |
if $self->{verbose}; |
| 347 |
|
365 |
|
| 348 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
366 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$t_dir":"$t_dir/en/"; |
| 349 |
my $lang_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/$self->{lang}"; |
367 |
my $lang_dir = ( $trans->{name} =~ /help/ )?"$t_dir":"$t_dir/$self->{lang}"; |
| 350 |
$lang_dir =~ s|/en/|/$self->{lang}/|; |
368 |
$lang_dir =~ s|/en/|/$self->{lang}/|; |
| 351 |
mkdir $lang_dir unless -d $lang_dir; |
369 |
mkdir $lang_dir unless -d $lang_dir; |
| 352 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
370 |
my $excludes = ( $trans->{name} !~ /help/ )?"":"-x 'help'"; |
| 353 |
|
371 |
push( @files, $trans->{name} ) if ( $trans->{name} =~ /MARC/ ); # for MARC translations |
| 354 |
system |
372 |
@nofiles = ( 'marc21', 'unimarc', 'normarc' ) if ( $trans->{name} !~ /MARC/ ); # hardcoded MARC variants |
| 355 |
"$self->{process} install " . |
373 |
|
| 356 |
"-i $trans_dir " . |
374 |
system |
| 357 |
"-o $lang_dir ". |
375 |
"$self->{process} install " . |
| 358 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
376 |
"-i $trans_dir " . |
| 359 |
( |
377 |
"-o $lang_dir ". |
| 360 |
@$files |
378 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
| 361 |
? ' -f ' . join ' -f ', @$files |
379 |
"$excludes " . |
| 362 |
: '' |
380 |
( @files ? ' -f ' . join ' -f ', @files : '') . |
| 363 |
) |
381 |
( @nofiles ? ' -n ' . join ' -n ', @nofiles : ''); |
|
|
382 |
} |
| 364 |
} |
383 |
} |
| 365 |
} |
384 |
} |
| 366 |
|
385 |
|
|
Lines 370-395
sub update_tmpl {
Link Here
|
| 370 |
|
389 |
|
| 371 |
say "Update templates" if $self->{verbose}; |
390 |
say "Update templates" if $self->{verbose}; |
| 372 |
for my $trans ( @{$self->{interface}} ) { |
391 |
for my $trans ( @{$self->{interface}} ) { |
|
|
392 |
my @files = @$files; |
| 393 |
my @nofiles = (); |
| 373 |
print |
394 |
print |
| 374 |
" Update templates '$trans->{name}'\n", |
395 |
" Update templates '$trans->{name}'\n", |
| 375 |
" From: $trans->{dir}/en/\n", |
396 |
" From: $trans->{dir}/en/\n", |
| 376 |
" To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
397 |
" To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
| 377 |
if $self->{verbose}; |
398 |
if $self->{verbose}; |
| 378 |
my $lang_dir = "$trans->{dir}/$self->{lang}"; |
|
|
| 379 |
mkdir $lang_dir unless -d $lang_dir; |
| 380 |
|
399 |
|
| 381 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
400 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":join("/en/ -i ",split(" ",$trans->{dir}))."/en/"; # multiple source dirs |
| 382 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
401 |
my $excludes = ( $trans->{name} !~ /help/ )?"":"-x 'help'"; |
|
|
402 |
push( @files, $trans->{name} ) if ( $trans->{name} =~ /MARC/ ); # for MARC translations |
| 403 |
@nofiles = ( 'marc21', 'unimarc', 'normarc' ) if ( $trans->{name} !~ /MARC/ ); # hardcoded MARC variants |
| 383 |
|
404 |
|
| 384 |
system |
405 |
system |
| 385 |
"$self->{process} update " . |
406 |
"$self->{process} update " . |
| 386 |
"-i $trans_dir " . |
407 |
"-i $trans_dir " . |
| 387 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
408 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
| 388 |
( |
409 |
"$excludes " . |
| 389 |
@$files |
410 |
( @files ? ' -f ' . join ' -f ', @files : '') . |
| 390 |
? ' -f ' . join ' -f ', @$files |
411 |
( @nofiles ? ' -n ' . join ' -n ', @nofiles : ''); |
| 391 |
: '' |
|
|
| 392 |
) |
| 393 |
} |
412 |
} |
| 394 |
} |
413 |
} |
| 395 |
|
414 |
|
|
Lines 411-434
sub create_tmpl {
Link Here
|
| 411 |
|
430 |
|
| 412 |
say "Create templates\n" if $self->{verbose}; |
431 |
say "Create templates\n" if $self->{verbose}; |
| 413 |
for my $trans ( @{$self->{interface}} ) { |
432 |
for my $trans ( @{$self->{interface}} ) { |
|
|
433 |
my @files = @$files; |
| 434 |
my @nofiles = (); |
| 414 |
print |
435 |
print |
| 415 |
" Create templates .po files for '$trans->{name}'\n", |
436 |
" Create templates .po files for '$trans->{name}'\n", |
| 416 |
" From: $trans->{dir}/en/\n", |
437 |
" From: $trans->{dir}/en/\n", |
| 417 |
" To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
438 |
" To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
| 418 |
if $self->{verbose}; |
439 |
if $self->{verbose}; |
| 419 |
|
440 |
|
| 420 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
441 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":join("/en/ -i ",split(" ",$trans->{dir}))."/en/"; # multiple source dirs |
| 421 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
442 |
my $excludes = ( $trans->{name} !~ /help/ )?"-x help":""; |
|
|
443 |
push( @files, $trans->{name} ) if ( $trans->{name} =~ /MARC/ ); # for MARC translations |
| 444 |
@nofiles = ( 'marc21', 'unimarc', 'normarc' ) if ( $trans->{name} !~ /MARC/ ); # hardcoded MARC variants |
| 422 |
|
445 |
|
| 423 |
system |
446 |
system |
| 424 |
"$self->{process} create " . |
447 |
"$self->{process} create " . |
| 425 |
"-i $trans_dir " . |
448 |
"-i $trans_dir " . |
| 426 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
449 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
| 427 |
( |
450 |
"$excludes " . |
| 428 |
@$files |
451 |
( @files ? ' -f ' . join ' -f ', @files : '') . |
| 429 |
? ' -f ' . join ' -f ', @$files |
452 |
( @nofiles ? ' -n ' . join ' -n ', @nofiles : ''); |
| 430 |
: '' |
|
|
| 431 |
) |
| 432 |
} |
453 |
} |
| 433 |
} |
454 |
} |
| 434 |
|
455 |
|
|
Lines 590-606
appropriate directory.
Link Here
|
| 590 |
|
611 |
|
| 591 |
=item translate create F<lang> |
612 |
=item translate create F<lang> |
| 592 |
|
613 |
|
| 593 |
Create 3 .po files in F<po> subdirectory: (1) from opac pages templates, (2) |
614 |
Create 4 kinds of .po files in F<po> subdirectory: |
| 594 |
intranet templates, and (3) from preferences. |
615 |
(1) one from each theme on opac pages templates, |
|
|
616 |
(2) intranet templates and help, |
| 617 |
(3) preferences, and |
| 618 |
(4) one for each MARC dialect. |
| 619 |
|
| 595 |
|
620 |
|
| 596 |
=over |
621 |
=over |
| 597 |
|
622 |
|
| 598 |
=item F<lang>-opac.po |
623 |
=item F<lang>-opac-{theme}.po |
| 599 |
|
624 |
|
| 600 |
Contains extracted text from english (en) OPAC templates found in |
625 |
Contains extracted text from english (en) OPAC templates found in |
| 601 |
<KOHA_ROOT>/koha-tmpl/opac-tmpl/prog/en/ directory. |
626 |
<KOHA_ROOT>/koha-tmpl/opac-tmpl/{theme}/en/ directory. |
| 602 |
|
627 |
|
| 603 |
=item F<lang>-intranet.po |
628 |
=item F<lang>-staff-prog.po and F<lang>-staff-help.po |
| 604 |
|
629 |
|
| 605 |
Contains extracted text from english (en) intranet templates found in |
630 |
Contains extracted text from english (en) intranet templates found in |
| 606 |
<KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory. |
631 |
<KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory. |
|
Lines 611-616
Contains extracted text from english (en) preferences. They are found in files
Link Here
|
| 611 |
located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences |
636 |
located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences |
| 612 |
directory. |
637 |
directory. |
| 613 |
|
638 |
|
|
|
639 |
=item F<lang>-marc-{MARC}.po |
| 640 |
|
| 641 |
Contains extracted text from english (en) files from opac and intranet, |
| 642 |
related with MARC dialects. |
| 643 |
|
| 614 |
=back |
644 |
=back |
| 615 |
|
645 |
|
| 616 |
=item pref-trans update F<lang> |
646 |
=item pref-trans update F<lang> |
| 617 |
- |
|
|