[Patches] [PATCH] Bug 6755 Problems when switching languages

koha-patchbot at kohaaloha.com koha-patchbot at kohaaloha.com
Wed Dec 21 03:12:04 NZDT 2011


From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Demians?= <f.demians at tamil.fr>
Date: Fri, 16 Dec 2011 09:57:00 +0100
Subject: [PATCH] Bug 6755 Problems when switching languages

As a side effect of patches for bug 6629, this bug has been reintroduced in
HEAD and 3.6.x.

To reproduce it:

- Define two languages for OPAC: en and fr-FR
- Open Firefox (for example)
- Menu Edit > Preferences, tab Option: select Language fr, en
- Clear your cookies
- Open the OPAC
- The OPAC is displayed in English. This is wrong. The fr templates
  should have been used based on browser languages preferences.
---
 C4/Templates.pm |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/C4/Templates.pm b/C4/Templates.pm
index 73d94c2..f671cbb 100644
--- a/C4/Templates.pm
+++ b/C4/Templates.pm
@@ -319,14 +319,8 @@ sub setlanguagecookie {
 
 sub getlanguagecookie {
     my ($query) = @_;
-    my $lang;
-    if ($query->cookie('KohaOpacLanguage')){
-        $lang = $query->cookie('KohaOpacLanguage') ;
-    }else{
-        $lang = $ENV{HTTP_ACCEPT_LANGUAGE};
-        
-    }
-    $lang =~ s/[^a-zA-Z_-]*//; #sanitzie
+    my $lang = $query->cookie('KohaOpacLanguage') || '';
+    $lang =~ s/[^a-zA-Z_-]*//; #sanitize
     return $lang;
 }
 
-- 
1.7.8




More information about the Patches mailing list