From a3e0c11fe478c07a357835ac87a7f58f60f05b6d Mon Sep 17 00:00:00 2001 From: Nahuel ANGELINETTI Date: Wed, 23 Sep 2009 14:56:44 +0200 Subject: [PATCH] (bug #3655) fix news language detection 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 file changed, 5 insertions(+), 1 deletion(-) diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 41fa1d4ae4..f724b9daa4 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' ; -- 2.39.5