[Bug 9735] New: Choose OPAC language in links to any page
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Bug ID: 9735 Summary: Choose OPAC language in links to any page Classification: Unclassified Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: OPAC Assignee: oleonard@myacpl.org Reporter: tomascohen@gmail.com The key idea was pointed by kf on Bug 7514: having a 'language' parameter parsed to circumvent cookies and browser detection for language selection. On that bug it was provided a way to have a URL for retreiving the OPAC's homepage in the desired language (http://OPAC_FQDN/cgi-bin/koha/changelanguage.pl?language=<LANG_CODE>) [1] This bugs ask for the implementation of this OPAC-wide, not just for the homepage. Regards To+ [1] After 9731 is applied http://OPAC_FQDN/cgi-bin/koha/opac-changelanguage.pl?language=<LANG_CODE> should be used -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Change sponsored?|--- |Sponsored Assignee|oleonard@myacpl.org |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Choose OPAC language in |Choose language using URL |links to any page |parameters in any page -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 15832 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=15832&action=edit Bug 9735 - Let the language be selected through URL parameters Passing language=<valid_language_code> as a parameter in any Koha's URL can be used to set the desired language. This patch touches - C4::Templates - C4::Auth Adds a new method getlanguagecookie that does exactly that, for use in get_template_and_user. Also modifies getlanguage so it checks (a) if there's a 'language' parameter in the CGI object and (b) checks if its valid and enabled for the desired interface. To test: * Without the patch - access any koha page - add ?language=code to the end of the URL (change code for a valid language code it needs to be installed using perl translate install code, and enabled either for the staff or opac interface, depending where are you testing) - Nothing happens with the language parameter * With the patch - access any koha page - add ?language=code (the same as before) and hit enter - the language should be changed to the one you chose - if you browse through some links, you will see koha 'remembers' the language you passed as a parameter (i.e. the language cookie has been updated). Regards To+ Sponsored-by: Universidad Nacional de Córdoba -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #2 from Brendan Gallagher <brendan@bywatersolutions.com> --- Created attachment 16081 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=16081&action=edit Bug 9735 - Let the language be selected through URL parameters Passing language=<valid_language_code> as a parameter in any Koha's URL can be used to set the desired language. This patch touches - C4::Templates - C4::Auth Adds a new method getlanguagecookie that does exactly that, for use in get_template_and_user. Also modifies getlanguage so it checks (a) if there's a 'language' parameter in the CGI object and (b) checks if its valid and enabled for the desired interface. To test: * Without the patch - access any koha page - add ?language=code to the end of the URL (change code for a valid language code it needs to be installed using perl translate install code, and enabled either for the staff or opac interface, depending where are you testing) - Nothing happens with the language parameter * With the patch - access any koha page - add ?language=code (the same as before) and hit enter - the language should be changed to the one you chose - if you browse through some links, you will see koha 'remembers' the language you passed as a parameter (i.e. the language cookie has been updated). Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Brendan <brendan@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #15832|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |brendan@bywatersolutions.co | |m -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #16081|0 |1 is obsolete| | --- Comment #3 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 16091 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=16091&action=edit [SIGNED-OFF] Bug 9735 - Let the language be selected through URL parameters Passing language=<valid_language_code> as a parameter in any Koha's URL can be used to set the desired language. This patch touches - C4::Templates - C4::Auth Adds a new method getlanguagecookie that does exactly that, for use in get_template_and_user. Also modifies getlanguage so it checks (a) if there's a 'language' parameter in the CGI object and (b) checks if its valid and enabled for the desired interface. To test: * Without the patch - access any koha page - add ?language=code to the end of the URL (change code for a valid language code it needs to be installed using perl translate install code, and enabled either for the staff or opac interface, depending where are you testing) - Nothing happens with the language parameter * With the patch - access any koha page - add ?language=code (the same as before) and hit enter - the language should be changed to the one you chose - if you browse through some links, you will see koha 'remembers' the language you passed as a parameter (i.e. the language cookie has been updated). Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Brendan <brendan@bywatersolutions.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Works very well. No errors. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chris@bigballofwax.co.nz -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #4 from Chris Cormack <chris@bigballofwax.co.nz> --- Created attachment 18490 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18490&action=edit Bug 9735 - Let the language be selected through URL parameters Passing language=<valid_language_code> as a parameter in any Koha's URL can be used to set the desired language. This patch touches - C4::Templates - C4::Auth Adds a new method getlanguagecookie that does exactly that, for use in get_template_and_user. Also modifies getlanguage so it checks (a) if there's a 'language' parameter in the CGI object and (b) checks if its valid and enabled for the desired interface. To test: * Without the patch - access any koha page - add ?language=code to the end of the URL (change code for a valid language code it needs to be installed using perl translate install code, and enabled either for the staff or opac interface, depending where are you testing) - Nothing happens with the language parameter * With the patch - access any koha page - add ?language=code (the same as before) and hit enter - the language should be changed to the one you chose - if you browse through some links, you will see koha 'remembers' the language you passed as a parameter (i.e. the language cookie has been updated). Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Brendan <brendan@bywatersolutions.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Works very well. No errors. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #16091|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA CC| |gmcharlt@gmail.com --- Comment #5 from Galen Charlton <gmcharlt@gmail.com> --- Reading the code, I see an issue with how the arrayref of cookies is managed. Specifically, consider this scenario: [1] OPAC user starts using the catalog anonymously and builds up some recent searches. [2] OPAC user decides to log in. As it happens, the OPAC has been customized so that the login form permits the user to set their preferred language via the new language parameter. If you trace through the code, it looks like the cookie structure that gets returned in that case would be something like this: [ [ $original_session_cookie, $search_cookie ], $languagecookie ] When this arrayref-inside-arrayref structure is passed to CGI's header method, some testing I did shows that CGI.pm doesn't flatten the list, so the header returned would look like this: Status: 200 OK Set-Cookie: ARRAY(0x222ad48) Set-Cookie: (language cookie) Date: Wed, 05 Jun 2013 16:07:59 GMT Pragma: no-cache Cache-control: no-cache Content-Type: text/html; charset=UTF-8 The end result is that the login would fail. I admit that this example is a little contrived, but it's not beyond the realm of possibility that somebody would want to do this. Consequently, I'm setting this to Failed QA. Please follow up by adjusting the code to ensure that if multiple cookies are set by get_template_and_user(), they all come back as a flat arrayref, not a nested on. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 18685 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18685&action=edit Bug 9735 - Build the cookie array correctly The current implementation didn't build the cookie array correctly, yielding login problems in some scenarios. Regards To+ Sponsored-by: Universidad Nacional de Córdoba http://bugs.koha-community.org/show_bug.cgi?id=6735 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- The followup for this is really simple -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 20915 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=20915&action=edit Bug 9735: Unit tests for get_template_and_user (cookies handling) Galen found a case where the cookies array was not built flat. I add a unit test for that (check the cookie array is flat) and also test the cookies output of get_template_and_user so we are sure the &language= parameter is correctly handled. Regards To+ Sponsored-by: Universidad Nacional de Cordoba -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #18490|0 |1 is obsolete| | CC| |julian.maurice@biblibre.com --- Comment #9 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 21421 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=21421&action=edit Bug 9735 - Let the language be selected through URL parameters -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #10 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 21422 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=21422&action=edit Bug 9735 - Build the cookie array correctly -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #18685|0 |1 is obsolete| | Attachment #20915|0 |1 is obsolete| | --- Comment #11 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 21423 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=21423&action=edit Bug 9735: Unit tests for get_template_and_user (cookies handling) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off --- Comment #12 from Julian Maurice <julian.maurice@biblibre.com> --- works nicely, unit tests pass Signed off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #13 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 21526 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=21526&action=edit [PASSED QA] Bug 9735 - Let the language be selected through URL parameters Passing language=<valid_language_code> as a parameter in any Koha's URL can be used to set the desired language. This patch touches - C4::Templates - C4::Auth Adds a new method getlanguagecookie that does exactly that, for use in get_template_and_user. Also modifies getlanguage so it checks (a) if there's a 'language' parameter in the CGI object and (b) checks if its valid and enabled for the desired interface. To test: * Without the patch - access any koha page - add ?language=code to the end of the URL (change code for a valid language code it needs to be installed using perl translate install code, and enabled either for the staff or opac interface, depending where are you testing) - Nothing happens with the language parameter * With the patch - access any koha page - add ?language=code (the same as before) and hit enter - the language should be changed to the one you chose - if you browse through some links, you will see koha 'remembers' the language you passed as a parameter (i.e. the language cookie has been updated). Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Brendan <brendan@bywatersolutions.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Works very well. No errors. Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Passes all tests and QA script. More comments on last patch. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #14 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 21527 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=21527&action=edit [PASSED QA] Bug 9735 - Build the cookie array correctly The current implementation didn't build the cookie array correctly, yielding login problems in some scenarios. Regards To+ Sponsored-by: Universidad Nacional de Córdoba http://bugs.koha-community.org/show_bug.cgi?id=6735 Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 21528 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=21528&action=edit [PASSED QA] Bug 9735: Unit tests for get_template_and_user (cookies handling) Galen found a case where the cookies array was not built flat. I add a unit test for that (check the cookie array is flat) and also test the cookies output of get_template_and_user so we are sure the &language= parameter is correctly handled. Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> - Tests in t/db_dependent/Auth.t pass - Tested in intranet, OPAC logged in, OPAC logged out * Adding a valid language code to the URL switches the language as expected * Adding an invalid language code causes no change Nice feature! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #21421|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #21422|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #21423|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_3_14_candidate -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9735 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #16 from Galen Charlton <gmcharlt@gmail.com> --- Pushed to master. Thanks, Tomás! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org