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 list) |
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}} ) { |
332 |
print |
346 |
my @t_dirs = split(" ", $trans->{dir}); |
333 |
" Install templates '$trans->{name}'\n", |
347 |
for my $t_dir ( @t_dirs ) { |
334 |
" From: $trans->{dir}/en/\n", |
348 |
print |
335 |
" To : $trans->{dir}/$self->{lang}\n", |
349 |
" Install templates '$trans->{name}'\n", |
336 |
" With: $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
350 |
" From: $t_dir/en/\n", |
|
|
351 |
" To : $t_dir/$self->{lang}\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} !~ /help/ )?"":"-x 'help'"; |
344 |
|
360 |
my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations |
345 |
system |
361 |
my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants |
346 |
"$self->{process} install " . |
362 |
|
347 |
"-i $trans_dir " . |
363 |
system |
348 |
"-o $lang_dir ". |
364 |
"$self->{process} install " . |
349 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
365 |
"-i $trans_dir " . |
350 |
( |
366 |
"-o $lang_dir ". |
351 |
@$files |
367 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
352 |
? ' -f ' . join ' -f ', @$files |
368 |
"$excludes " . |
353 |
: '' |
369 |
"$match " . |
354 |
) |
370 |
"$nomatch " . |
|
|
371 |
( |
372 |
@$files |
373 |
? ' -f ' . join ' -f ', @$files |
374 |
: '' |
375 |
) |
376 |
} |
355 |
} |
377 |
} |
356 |
} |
378 |
} |
357 |
|
379 |
|
Lines 366-381
sub update_tmpl {
Link Here
|
366 |
" From: $trans->{dir}/en/\n", |
388 |
" From: $trans->{dir}/en/\n", |
367 |
" To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
389 |
" To : $self->{path_po}/$self->{lang}$trans->{suffix}\n" |
368 |
if $self->{verbose}; |
390 |
if $self->{verbose}; |
369 |
my $lang_dir = "$trans->{dir}/$self->{lang}"; |
|
|
370 |
mkdir $lang_dir unless -d $lang_dir; |
371 |
|
391 |
|
372 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
392 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
373 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
393 |
my $excludes = ( $trans->{name} !~ /help/ )?"":"-x 'help'"; |
|
|
394 |
my $dirs = join(" -i ",split(" ",$trans->{dir})); # multiple source dirs |
395 |
my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations |
396 |
my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants |
397 |
|
374 |
|
398 |
|
375 |
system |
399 |
system |
376 |
"$self->{process} update " . |
400 |
"$self->{process} update " . |
377 |
"-i $trans_dir " . |
401 |
"-i $dirs " . |
378 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
402 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
|
|
403 |
"$excludes " . |
404 |
"$match " . |
405 |
"$nomatch " . |
379 |
( |
406 |
( |
380 |
@$files |
407 |
@$files |
381 |
? ' -f ' . join ' -f ', @$files |
408 |
? ' -f ' . join ' -f ', @$files |
Lines 409-420
sub create_tmpl {
Link Here
|
409 |
if $self->{verbose}; |
436 |
if $self->{verbose}; |
410 |
|
437 |
|
411 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
438 |
my $trans_dir = ( $trans->{name} =~ /help/ )?"$trans->{dir}":"$trans->{dir}/en/"; |
412 |
my $excludes = ( $trans->{name} =~ /UI/ )?"-x 'help'":""; |
439 |
my $excludes = ( $trans->{name} !~ /help/ )?"":"-x 'help'"; |
|
|
440 |
my $dirs = join(" -i ",split(" ",$trans->{dir})); # multiple source dirs |
441 |
my $match = ( $trans->{name} =~ /MARC/ )?"-m \"$trans->{name}\"":""; # for MARC translations |
442 |
my $nomatch = ( $trans->{name} !~ /MARC/ )?"-n \"marc21|unimarc|normarc\"":""; # hardcoded MARC variants |
413 |
|
443 |
|
414 |
system |
444 |
system |
415 |
"$self->{process} create " . |
445 |
"$self->{process} create " . |
416 |
"-i $trans_dir " . |
446 |
"-i $dirs " . |
417 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r $excludes" . |
447 |
"-s $self->{path_po}/$self->{lang}$trans->{suffix} -r " . |
|
|
448 |
"$excludes " . |
449 |
"$match " . |
450 |
"$nomatch " . |
418 |
( |
451 |
( |
419 |
@$files |
452 |
@$files |
420 |
? ' -f ' . join ' -f ', @$files |
453 |
? ' -f ' . join ' -f ', @$files |
Lines 504-520
appropriate directory.
Link Here
|
504 |
|
537 |
|
505 |
=item translate create F<lang> |
538 |
=item translate create F<lang> |
506 |
|
539 |
|
507 |
Create 3 .po files in F<po> subdirectory: (1) from opac pages templates, (2) |
540 |
Create 4 kinds of .po files in F<po> subdirectory: |
508 |
intranet templates, and (3) from preferences. |
541 |
(1) one from each theme on opac pages templates, |
|
|
542 |
(2) intranet templates and help, |
543 |
(3) preferences, and |
544 |
(4) one for each MARC dialect. |
545 |
|
509 |
|
546 |
|
510 |
=over |
547 |
=over |
511 |
|
548 |
|
512 |
=item F<lang>-opac.po |
549 |
=item F<lang>-opac-{theme}.po |
513 |
|
550 |
|
514 |
Contains extracted text from english (en) OPAC templates found in |
551 |
Contains extracted text from english (en) OPAC templates found in |
515 |
<KOHA_ROOT>/koha-tmpl/opac-tmpl/prog/en/ directory. |
552 |
<KOHA_ROOT>/koha-tmpl/opac-tmpl/{theme}/en/ directory. |
516 |
|
553 |
|
517 |
=item F<lang>-intranet.po |
554 |
=item F<lang>-staff-prog.po and F<lang>-staff-help.po |
518 |
|
555 |
|
519 |
Contains extracted text from english (en) intranet templates found in |
556 |
Contains extracted text from english (en) intranet templates found in |
520 |
<KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory. |
557 |
<KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/ directory. |
Lines 525-530
Contains extracted text from english (en) preferences. They are found in files
Link Here
|
525 |
located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences |
562 |
located in <KOHA_ROOT>/koha-tmpl/intranet-tmpl/prog/en/admin/preferences |
526 |
directory. |
563 |
directory. |
527 |
|
564 |
|
|
|
565 |
=item F<lang>-marc-{MARC}.po |
566 |
|
567 |
Contains extracted text from english (en) files from opac and intranet, |
568 |
related with MARC dialects. |
569 |
|
528 |
=back |
570 |
=back |
529 |
|
571 |
|
530 |
=item pref-trans update F<lang> |
572 |
=item pref-trans update F<lang> |
531 |
- |
|
|