Bug 12535 - PROG/CCSR Deprecation: Make opac translation theme independent
authorBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Mon, 7 Jul 2014 01:11:14 +0000 (22:11 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 30 Oct 2014 01:00:22 +0000 (22:00 -0300)
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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described, no problems found.

Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
misc/translator/LangInstaller.pm
misc/translator/translate

index 6ced014..c538b57 100644 (file)
@@ -84,19 +84,14 @@ 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;
 
     # Map for both interfaces opac/intranet
     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',
@@ -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<lang>-opac.po
+=item F<lang>-opac-{theme}.po
 
 Contains extracted text from english (en) OPAC templates found in
-<KOHA_ROOT>/koha-tmpl/opac-tmpl/prog/en/ directory.
+<KOHA_ROOT>/koha-tmpl/opac-tmpl/{theme}/en/ directory.
 
 =item F<lang>-intranet.po
 
index da41a97..63e4177 100755 (executable)
@@ -106,10 +106,10 @@ version of templates and preferences are used as references.
 
 =over
 
-=item F<lang>-opac.po
+=item F<lang>-opac-{theme}.po
 
 Contains extracted text from english (en) OPAC templates found in
-<KOHA_ROOT>/koha-tmpl/opac-tmpl/prog/en/ directory.
+<KOHA_ROOT>/koha-tmpl/opac-tmpl/{theme}/en/ directory.
 
 =item F<lang>-intranet.po