Bug 16776

Summary: If language is set by external link language switcher does not work
Product: Koha Reporter: Marc Véron <veron>
Component: I18N/L10NAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: f.demians, jonathan.druart, julian.maurice, kyle
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 16776 - If language is set by external link language switcher does not work
Bug 16776 - If language is set by external link language switcher does not work
[SIGNED-OFF] Bug 16776 - If language is set by external link language switcher does not work
[ALT] Bug 16776: Do not forget external language choice in language switcher
Bug 16776: Do not forget external language choice in language switcher
[PASSED QA] Bug 16776: Do not forget external language choice in language switcher

Description Marc Véron 2016-06-20 08:52:42 UTC
Follwoing scenario:

- Have a multilingual koha installation, let's say en, de-CH, fr-FR and it-IT
- Create external links e.g. from the 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.
Comment 1 Marc Véron 2016-06-20 20:56:47 UTC Comment hidden (obsolete)
Comment 2 Marc Véron 2016-07-10 18:48:47 UTC
Still applies.
Comment 3 Owen Leonard 2016-07-11 15:40:06 UTC
Sorry, this isn't working for me at all. There is no change in behavior after the patch is applied. Switching language via the URL still works, but using the language-switcher afterwards still fails. The URL is not modified.
Comment 4 Marc Véron 2016-07-12 18:15:38 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2016-07-18 13:10:59 UTC Comment hidden (obsolete)
Comment 6 Marc Véron 2016-07-21 05:39:18 UTC
Still applies.
Comment 7 Jonathan Druart 2016-07-25 15:39:03 UTC Comment hidden (obsolete)
Comment 8 Jonathan Druart 2016-07-25 15:39:39 UTC
Marc, could you take a look at this counter-patch?
Using regex seems easier to resolve this issue.
Comment 9 Marc Véron 2016-07-25 16:58:12 UTC
I tested, the counter patch works as well. That is the most important thing, I will sign-off.
Hmm, patch title schuld say: Forget external language choice in language switcher (i.e. language switcher should not take care of language set by external link)
Comment 10 Marc Véron 2016-07-25 16:59:18 UTC Comment hidden (obsolete)
Comment 11 Marc Véron 2016-07-25 17:00:25 UTC
Comment on attachment 53473 [details] [review]
[SIGNED-OFF] Bug 16776 - If language is set by external link language switcher does not work

Obsoelted in favour of Jonathan's counter patch.
Comment 12 Jonathan Druart 2016-07-25 17:27:56 UTC
(In reply to Marc Véron from comment #9)
> I tested, the counter patch works as well. That is the most important thing,
> I will sign-off.
> Hmm, patch title schuld say: Forget external language choice in language
> switcher (i.e. language switcher should not take care of language set by
> external link)

Well, it depends on how you see things actually :)
I wanted to say: Do not forget what has been passed in url when you click on the language switcher.
Comment 13 Marc Véron 2016-07-26 11:51:15 UTC
Setting to signed-off (for counter patch, tested 2016-07-26 - comment #10)
Comment 14 Katrin Fischer 2016-08-07 11:35:12 UTC
Created attachment 54117 [details] [review]
[PASSED QA] 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

Tested counter patch, works as well.
Signed-off-by: Marc <veron@veron.ch>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Kyle M Hall (khall) 2016-08-10 13:51:47 UTC
Pushed to master for 16.11, thanks Jonathan!
Comment 16 Frédéric Demians 2016-08-23 09:44:52 UTC
Pushed in 16.05. Will be in 16.05.03.
Comment 17 Julian Maurice 2016-08-23 15:42:02 UTC
Pushed to 3.22.x, will be in 3.22.10