[Bug 7282] New: invalid language selection
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Bug #: 7282 Summary: invalid language selection Classification: Unclassified Change sponsored?: --- Product: Koha Version: unspecified Platform: All OS/Version: All Status: NEW Severity: major Priority: P5 - low Component: I18N/L10N AssignedTo: frederic@tamil.fr ReportedBy: semarie-koha@latrappe.fr QAContact: ian.walls@bywatersolutions.com A problem was issue after patch for bug 6629 (cookie language sanitization), for language selection. Before the patch for 6629: in C4::Templates::themelanguage, language is taken from: if cookie: lang = C4::Templates::getlanguagecookie else - HTTP_ACCEPT_LANGUAGE (parsed and interpreted) checked against sysprefs 'en' else After the patch: in C4::Templates::themelanguage, language is taken from: lang = C4::Templates::getlanguagecookie if not lang: - HTTP_ACCEPT_LANGUAGE (parsed and interpreted) checked against sysprefs 'en' else But in C4::Templates::getlanguagecookie, language is taken from: - cookie (if exist) - else from: - HTTP_ACCEPT_LANGUAGE (not parsed, so lang could be set to "fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3") (which almost always exists) - result is sanitized (so if not cookie: my language is something like "frfr-frq08enusq05enq03", but not installed in koha :-) ) -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frère Sébastien Marie <semarie-koha@latrappe.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED AssignedTo|frederic@tamil.fr |semarie-koha@latrappe.fr --- Comment #1 from Frère Sébastien Marie <semarie-koha@latrappe.fr> 2011-12-01 16:04:14 UTC --- Created attachment 6486 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=6486 Bug 7282: invalid language selection This patch restore the original behavior. Perhaps getlanguagecookie should be improve to parse and interprete HTTP_ACCEPT_LANGUAGE too ? But duplicate code (in themelanguage) should be stripped. And his name is getlanguagecookie ... so should be only the language from cookie ? if yes, discard HTTP_ACCEPT_LANGUAGE from getlanguagecookie is a solution... So, a more elaborate patch could be done. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frère Sébastien Marie <semarie-koha@latrappe.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P5 - low |PATCH-Sent Patch Status|--- |Needs Signoff -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz --- Comment #2 from Chris Cormack <chris@bigballofwax.co.nz> 2011-12-01 16:10:08 UTC --- Ah yep, good catch, ill test a little more and sign off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #6486|0 |1 is obsolete| | --- Comment #3 from Chris Cormack <chris@bigballofwax.co.nz> 2011-12-01 16:17:51 UTC --- Created attachment 6487 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=6487 Bug 7282: invalid language selection - restore the original behavior: call getlanguagecookie only if the cookie is present Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Needs Signoff |Signed Off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |frederic@tamil.fr --- Comment #4 from Frédéric Demians <frederic@tamil.fr> 2011-12-01 16:47:57 UTC ---
Perhaps getlanguagecookie should be improve to parse and interprete HTTP_ACCEPT_LANGUAGE too ? But duplicate code (in themelanguage) should be stripped.
And his name is getlanguagecookie ... so should be only the language from cookie ? if yes, discard HTTP_ACCEPT_LANGUAGE from getlanguagecookie is a solution...
Yes, there seems to have something wrong here. And for me it doesn't work as it should. This doesn't work: - Clear your browser cookies - Select fr, fr-fr, en languages - Load OPAC main page We should have fr templates selected, based on browser preference. We have English template. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Signed Off |Failed QA -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #5 from Chris Cormack <chris@bigballofwax.co.nz> 2011-12-01 16:54:01 UTC --- Frederic, FR is activated in the system preferences eh? -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #6 from Frédéric Demians <frederic@tamil.fr> 2011-12-01 16:59:41 UTC --- (In reply to comment #5)
Frederic, FR is activated in the system preferences eh?
Yes. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #6487|0 |1 is obsolete| | --- Comment #7 from Frédéric Demians <frederic@tamil.fr> 2011-12-01 17:04:50 UTC --- Created attachment 6488 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=6488 Proposed patch Bug 7282 Invalid language selection Frère Sébastien Marie refactored patch to ensure that without cookie, language selection is based on browser preferences. To reproduce the bug: - Activate en and fr-FR for OPAC - Clear your browser cookies - Select your language preference in your browser: fr, fr-fr, en - Load OPAC main page - OPAC is displayed in English, rather than French as asked by browser preferences Apply the patch and test: - Clear your browser cookies - Load OPAC main page - Pages are displayed in French -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Failed QA |Needs Signoff -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frère Sébastien Marie <semarie-koha@latrappe.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Needs Signoff |Failed QA --- Comment #8 from Frère Sébastien Marie <semarie-koha@latrappe.fr> 2011-12-01 17:53:55 UTC --- The attachment 6488 will break search pages, as getlanguagecookie is called by catalogue/search.pl and opac/opac-search.pl for obtain the locale for stems (option enable with syspref). -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #6488|0 |1 is obsolete| | --- Comment #9 from Frédéric Demians <frederic@tamil.fr> 2011-12-01 18:08:28 UTC --- Created attachment 6489 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=6489 Proposed patch, fixing comment 8 Bug 7282 Invalid language selection Frère Sébastien Marie refactored patch to ensure that without cookie, language selection is based on browser preferences. To reproduce the bug: - Activate en and fr-FR for OPAC - Clear your browser cookies - Select your language preference in your browser: fr, fr-fr, en - Load OPAC main page - OPAC is displayed in English, rather than French as asked by browser preferences Apply the patch and test: - Clear your browser cookies - Load OPAC main page - Pages are displayed in French -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Failed QA |Needs Signoff -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #10 from Frère Sébastien Marie <semarie-koha@latrappe.fr> 2011-12-01 18:09:45 UTC --- Created attachment 6490 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=6490 Bug 7282 - invalid language selection I don't known exactly how to test stem as it is biblioitems dependent. For language selection, same test as before. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #11 from Chris Cormack <chris@bigballofwax.co.nz> 2011-12-01 18:13:11 UTC --- I prefer the patch from Frère Sébastien Marie, otherwise we are introducing 2 new places where user input is not sanitised. Also, having the regexp in one place means fixing it, by adding g for example is a lot easier. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #12 from Frère Sébastien Marie <semarie-koha@latrappe.fr> 2011-12-01 18:17:17 UTC --- (In reply to comment #9)
Created attachment 6489 [details] Proposed patch, fixing comment 8
oh ! you have corrected same time as me... so two patchs are proposed... your has some drawbacks: - re-introduce uncheck user input (I don't known for impact of user controlled string in Lingua::Stem::Snowball). - without cookie, HTTP_ACCEPT_LANG is not used for stem how to deal for the two patch proposed ? -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #13 from Frédéric Demians <frederic@tamil.fr> 2011-12-01 18:38:34 UTC --- (In reply to comment #11)
I prefer the patch from Frère Sébastien Marie,
So do I. For the new getlanguage function, wouldn't it be better to explicitly specify the calling interface (opac/intra)? And call for example: my $lang = C4::Templates::getlanguage($cgi, 'opac'); -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frère Sébastien Marie <semarie-koha@latrappe.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #6490|0 |1 is obsolete| | --- Comment #14 from Frère Sébastien Marie <semarie-koha@latrappe.fr> 2011-12-01 18:48:00 UTC --- Created attachment 6491 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=6491 Bug 7282 - invalid language selection I agreed with Frederic, explicit parameter is better. I have corrected the patch accordingly, and correct a minor problem (the intranet search, as not specify the interface in getlanguage call, was using the 'opac' language... explicit argument is definitively better :-) ) -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #6489|0 |1 is obsolete| | Attachment #6491|0 |1 is obsolete| | --- Comment #15 from Frédéric Demians <frederic@tamil.fr> 2011-12-01 20:01:30 UTC --- Created attachment 6495 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=6495 Signed-off patch -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch Status|Needs Signoff |Signed Off -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-12-16 08:57:39 UTC --- Could bug 7282 make a difference here? It's waiting for QA. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Paul Poulain <paul.poulain@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paul.poulain@biblibre.com Version|unspecified |rel_3_6 Patch Status|Signed Off |Patch Pushed --- Comment #17 from Paul Poulain <paul.poulain@biblibre.com> 2011-12-16 13:32:41 UTC --- QA comment : valid code, fixes buggy behaviour perlcritic C4/Templates.pm C4/Templates.pm source OK perlcritic catalogue/ catalogue/search.pl source OK passed QA patch pushed, please test -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #18 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-12-18 20:57:00 UTC --- Works on master, waiting to close this bug until patch is in 3.6.x too. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 --- Comment #19 from Katrin Fischer <katrin.fischer@bsz-bw.de> 2011-12-23 13:34:45 UTC --- Chris N. - can you pick that for 3.6.x? It's really an annoying I18N bug, affects OPAC language detection and is confusing patrons. -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Magnus Enger <magnus@enger.priv.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |magnus@enger.priv.no --- Comment #20 from Magnus Enger <magnus@enger.priv.no> 2011-12-23 14:01:11 UTC --- +1 -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7282 Frère Sébastien Marie <semarie-koha@latrappe.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|PATCH-Sent (DO NOT USE) |P3 Status|Pushed to Stable |RESOLVED Resolution| |FIXED --- Comment #21 from Frère Sébastien Marie <semarie-koha@latrappe.fr> 2012-02-07 15:06:51 UTC --- Thanks -- Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org