[Koha-patches] [PATCH] (bug #3655) fix news language detection

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Wed Sep 23 15:02:38 CEST 2009


This patch improve the language detection for news in opac. If the user have no defined language in his browser.
---
 opac/opac-main.pl |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/opac/opac-main.pl b/opac/opac-main.pl
index 41fa1d4..f724b9d 100755
--- a/opac/opac-main.pl
+++ b/opac/opac-main.pl
@@ -26,7 +26,7 @@ use C4::Branch;          # GetBranches
 use C4::Members;         # GetMember
 use C4::NewsChannels;    # get_opac_news
 use C4::Acquisition;     # GetRecentAcqui
-use C4::Languages qw(getTranslatedLanguages);
+use C4::Languages qw(getTranslatedLanguages accept_language);
 
 my $input = new CGI;
 my $dbh   = C4::Context->dbh;
@@ -66,6 +66,10 @@ if($input->cookie('KohaOpacLanguage')){
             $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' ;
-- 
1.6.0.4




More information about the Koha-patches mailing list