From f0d0cded7635301c601bb48107cdfc09273551ce Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Sun, 6 Jul 2014 22:11:14 -0300 Subject: [PATCH] Bug 12535 - PROG/CCSR Deprecation: Make opac translation theme independent This patch makes opac translation files theme independent A side effect is that current prog translation file is renamed. But the renaming is not added, that gives a patch of ~60M! Current list of languages are now obtained from pref files. To test: 1) Apply the patch 2) For your preferred language, rename opac prog file from 'xx-YY-i-opac-t-prog-v-3006000.po' to 'xx-YY-opac-prog.po' 3) Update that language, there must be no errors cd misc/translation ./translate update xx-YY [-v] Check updated po files 4) Install any language, there must be no errors ./translate install xx-YY Check prog theme for that language 5) Create translation files. Remove a language or create new lang files ./translate create zz-WW ls -l po/zz-WW*po check there are 3 files (and *~) for opac 6) Check updated pod for LangInstaler.pm and translate script When PROG/CCSR themes are removed, I'll add a Bug to remove corresponding files. Perhaps RM could add a followup to rename all files, cd misc/translator/po for old in $(ls *opac-t*); do new=$(echo $old | sed 's/-i-opac-t-prog-v-3006000/-opac-prog/'); git mv $old $new; done --- misc/translator/LangInstaller.pm | 29 ++++++++++++----------------- misc/translator/translate | 4 ++-- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm index b89aaa8..695a8ec 100644 --- a/misc/translator/LangInstaller.pm +++ b/misc/translator/LangInstaller.pm @@ -84,8 +84,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; @@ -93,11 +93,6 @@ sub new { my $opachtdocs = $context->config('opachtdocs'); $self->{interface} = [ { - name => 'OPAC prog', - dir => "$opachtdocs/prog", - suffix => '-i-opac-t-prog-v-3006000.po', - }, - { name => 'Intranet prog UI', dir => $context->config('intrahtdocs') . '/prog', suffix => '-i-staff-t-prog-v-3006000.po', @@ -109,13 +104,13 @@ sub new { }, ]; - # Alternate opac themes - opendir $fh, $context->config('opachtdocs'); - for ( grep { not /^\.|\.\.|prog|lib$/ } readdir($fh) ) { + # OPAC themes + opendir my $dh, $context->config('opachtdocs'); + for my $theme ( grep { not /^\.|lib/ } readdir($dh) ) { push @{$self->{interface}}, { - name => "OPAC $_", - dir => "$opachtdocs/$_", - suffix => "-opac-$_.po", + name => "OPAC $theme", + dir => "$opachtdocs/$theme", + suffix => "-opac-$theme.po", }; } @@ -514,9 +509,9 @@ sub install { sub get_all_langs { my $self = shift; opendir( my $dh, $self->{path_po} ); - my @files = grep { $_ =~ /-i-opac-t-prog-v-3006000.po$/ } + my @files = grep { $_ =~ /-pref.po$/ } readdir $dh; - @files = map { $_ =~ s/-i-opac-t-prog-v-3006000.po$//; $_ } @files; + @files = map { $_ =~ s/-pref.po$//; $_ } @files; } @@ -595,10 +590,10 @@ intranet templates, and (3) from preferences. =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 diff --git a/misc/translator/translate b/misc/translator/translate index da41a97..63e4177 100755 --- a/misc/translator/translate +++ b/misc/translator/translate @@ -106,10 +106,10 @@ version of templates and preferences are used as references. =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 -- 1.9.1