[Koha-patches] [PATCH] 6755 Problems with switching languages

Marcel de Rooy M.de.Rooy at rijksmuseum.nl
Thu Aug 25 15:16:55 CEST 2011


This patch solves the situation that news is in another language than the Koha interface.
It just uses the same code now, removing unneeded lines.
---
 opac/opac-main.pl |   28 +---------------------------
 1 files changed, 1 insertions(+), 27 deletions(-)

diff --git a/opac/opac-main.pl b/opac/opac-main.pl
index 177d812..e2f069f 100755
--- a/opac/opac-main.pl
+++ b/opac/opac-main.pl
@@ -54,33 +54,7 @@ $template->param(
 
 # display news
 # use cookie setting for language, bug default to syspref if it's not set
-(my $theme) = themelanguage(C4::Context->config('opachtdocs'),'opac-main.tmpl','opac',$input);
-
-my $translations = getTranslatedLanguages('opac',$theme);
-my @languages = ();
-foreach my $trans (@$translations)
-{
-    push(@languages, $trans->{rfc4646_subtag});
-}
-
-my $news_lang;
-if($input->cookie('KohaOpacLanguage')){
-    $news_lang = $input->cookie('KohaOpacLanguage');
-}else{
-    if ($ENV{HTTP_ACCEPT_LANGUAGE}) {
-        while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){
-            if( my @lang = grep { /^$1$/i } @languages ) {
-                $news_lang = $lang[0];
-            }
-        }
-    }
-    if (not $news_lang) {
-        my @languages = split ",", C4::Context->preference("opaclanguages");
-        $news_lang = $languages[0];
-    }
-}
-
-$news_lang = $news_lang ? $news_lang : 'en' ;
+my ($theme, $news_lang) = themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input);
 
 my $all_koha_news   = &GetNewsToDisplay($news_lang);
 my $koha_news_count = scalar @$all_koha_news;
-- 
1.6.0.6



More information about the Koha-patches mailing list