Lines 54-86
$template->param(
Link Here
|
54 |
|
54 |
|
55 |
# display news |
55 |
# display news |
56 |
# use cookie setting for language, bug default to syspref if it's not set |
56 |
# use cookie setting for language, bug default to syspref if it's not set |
57 |
(my $theme) = themelanguage(C4::Context->config('opachtdocs'),'opac-main.tmpl','opac',$input); |
57 |
my ($theme, $news_lang) = C4::Output::themelanguage(C4::Context->config('opachtdocs'),'opac-main.tt','opac',$input); |
58 |
|
|
|
59 |
my $translations = getTranslatedLanguages('opac',$theme); |
60 |
my @languages = (); |
61 |
foreach my $trans (@$translations) |
62 |
{ |
63 |
push(@languages, $trans->{rfc4646_subtag}); |
64 |
} |
65 |
|
66 |
my $news_lang; |
67 |
if($input->cookie('KohaOpacLanguage')){ |
68 |
$news_lang = $input->cookie('KohaOpacLanguage'); |
69 |
}else{ |
70 |
if ($ENV{HTTP_ACCEPT_LANGUAGE}) { |
71 |
while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){ |
72 |
if( my @lang = grep { /^$1$/i } @languages ) { |
73 |
$news_lang = $lang[0]; |
74 |
} |
75 |
} |
76 |
} |
77 |
if (not $news_lang) { |
78 |
my @languages = split ",", C4::Context->preference("opaclanguages"); |
79 |
$news_lang = $languages[0]; |
80 |
} |
81 |
} |
82 |
|
83 |
$news_lang = $news_lang ? $news_lang : 'en' ; |
84 |
|
58 |
|
85 |
my $all_koha_news = &GetNewsToDisplay($news_lang); |
59 |
my $all_koha_news = &GetNewsToDisplay($news_lang); |
86 |
my $koha_news_count = scalar @$all_koha_news; |
60 |
my $koha_news_count = scalar @$all_koha_news; |
87 |
- |
|
|