Bugzilla – Attachment 53473 Details for
Bug 16776
If language is set by external link language switcher does not work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 16776 - If language is set by external link language switcher does not work
SIGNED-OFF-Bug-16776---If-language-is-set-by-exter.patch (text/plain), 2.39 KB, created by
Owen Leonard
on 2016-07-18 13:10:59 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 16776 - If language is set by external link language switcher does not work
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2016-07-18 13:10:59 UTC
Size:
2.39 KB
patch
obsolete
>From 9ea391ce0b7f254c15353d901883bcb01f674327 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Mon, 20 Jun 2016 21:25:32 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 16776 - If language is set by external link > language switcher does not work >Content-Type: text/plain; charset="utf-8" > >To reproduce: > >- Have a multilingual koha installation, let's say en, de-CH, fr-FR and > it-IT >- Create external links e.g. from your multilingual library website to > each language variant of OPAC: > >...cgi-bin/koha/opac-main.pl?language=en >...cgi-bin/koha/opac-main.pl?language=de-CH >...cgi-bin/koha/opac-main.pl?language=fr-FR >...cgi-bin/koha/opac-main.pl?language=it-IT > >Each link opens fine displaying the language as appropriate. > >Now try to switch language on the page you just opened via the external >link. > >It won't work, it will always stay on the language defined by the >external link. > >To test: >- Apply patch >- Repeat steps above >- Verify that the language switcher works >- Verify in browser address field that after switching language, the > param 'language= 'has vanished from url string >- Try links with multiple params and with params containing 'language', e.g. > ...cgi-bin/koha/opac-search.pl?language=fr-FR&q=language&mylanguage=test >- Verify that only the parameter 'language=' vanishes > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > opac/opac-changelanguage.pl | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > >diff --git a/opac/opac-changelanguage.pl b/opac/opac-changelanguage.pl >index 2773704..1325f5d 100755 >--- a/opac/opac-changelanguage.pl >+++ b/opac/opac-changelanguage.pl >@@ -25,4 +25,25 @@ my $language = $query->param('language'); > my $url = $query->referer() || '/'; > > # warn "Language : $query // $language // $url"; >+ >+# If language was set by an external URL the parameter >+# 'language=' should be removed from url string, otherwise >+# the language picker will not work - Bug 16776 >+ >+my @urlarr = split(/\?/,$url); >+if (scalar @urlarr > 1) { >+ my @paramarr = split(/&/,$urlarr[1]); >+ for my $index ( reverse 0..$#paramarr ) { >+ if ( $paramarr[$index] =~ /^language=/) { >+ splice(@paramarr, $index, 1, ()); >+ } >+ } >+ if ( scalar @paramarr > 0) { >+ $url = $urlarr[0].'?'.join('&', @paramarr); >+ } >+ else { >+ $url = $urlarr[0]; >+ } >+} >+ > C4::Templates::setlanguagecookie( $query, $language, $url ); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16776
:
52628
|
53331
|
53473
|
53693
|
53704
|
54117