Bugzilla – Attachment 53693 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]
[ALT] Bug 16776: Do not forget external language choice in language switcher
Bug-16776-Do-not-forget-external-language-choice-i.patch (text/plain), 2.50 KB, created by
Jonathan Druart
on 2016-07-25 15:39:03 UTC
(
hide
)
Description:
[ALT] Bug 16776: Do not forget external language choice in language switcher
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-07-25 15:39:03 UTC
Size:
2.50 KB
patch
obsolete
>From e98b5b2943f9a98c7c43ba702dd7775fef729d5b Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 25 Jul 2016 16:37:03 +0100 >Subject: [PATCH] Bug 16776: Do not forget external language choice in language > switcher > >If language is set by external link language switcher does not work > >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 >--- > changelanguage.pl | 4 +++- > opac/opac-changelanguage.pl | 7 +++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > >diff --git a/changelanguage.pl b/changelanguage.pl >index 9a72f8d..360484c 100755 >--- a/changelanguage.pl >+++ b/changelanguage.pl >@@ -25,5 +25,7 @@ my $query = new CGI; > my $language = $query->param('language'); > my $url = $query->referer(); > >-#warn "Language : $query // $language // $url"; >+$url =~ s|(.)language=[\w-]*&?|$1|; >+$url =~ s|(&\|\?)$||; # Remove extraneous ? or & >+ > C4::Templates::setlanguagecookie( $query, $language, $url ); >diff --git a/opac/opac-changelanguage.pl b/opac/opac-changelanguage.pl >index 2773704..9c68ab4 100755 >--- a/opac/opac-changelanguage.pl >+++ b/opac/opac-changelanguage.pl >@@ -25,4 +25,11 @@ 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 >+$url =~ s|(.)language=[\w-]*&?|$1|; >+$url =~ s|(&\|\?)$||; # Remove extraneous ? or & >+ > C4::Templates::setlanguagecookie( $query, $language, $url ); >-- >2.8.1
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