Bug 20504

Summary: Language attribute in html tag is empty in system preference editor
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: Staff interfaceAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: minor    
Priority: P5 - low CC: christian.stelzenmueller, fridolin.somers, gmcharlt, jonathan.druart, josef.moravec, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
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 20504: Fix lang attribute in html tag on systempreferences page
Bug 20504: Fix lang attribute in html tag on systempreferences page
Bug 20504: Fix lang attribute in html tag on systempreferences page

Description Katrin Fischer 2018-03-31 07:19:39 UTC
Koha populates the lanugage attribute of the html tag on all pages with the language code of the currently selected language. Apart from other things this allows customizations using the language code to control visibility of translated text.

This works well, but for the system preference editor, where the language attribute is empty:

<html lang="">
Comment 1 Katrin Fischer 2018-03-31 07:20:13 UTC
*** Bug 19591 has been marked as a duplicate of this bug. ***
Comment 2 Katrin Fischer 2018-08-08 23:56:47 UTC
The problem is that $lang is send to the template from preferences.pl and overwrites the normal $lang variable.

I *think* the variable is not used/never properly set.
Comment 3 Katrin Fischer 2018-08-09 17:49:57 UTC
Created attachment 77634 [details] [review]
Bug 20504: Fix lang attribute in html tag on systempreferences page

On the system preferences page the lang attribute of the
html tag is always empty.

To test:
- Go to systempreferences
- Check the html source and look at the html tag,
  it should read: <html lang="">
- Apply patch
- Check the html source again: <html lang="en">
  Verify the language code shown matches the currently
  selected language in the staff interface
- Verify the language system preferences work correctly
Comment 4 Katrin Fischer 2018-08-09 17:52:34 UTC
I am not totally sure about this one - it seems that the $lang variable in the preferences code was never set and not used in the template. But by overwriting the existing lang template variable, it broke the lang attribute in the html tag.
Comment 5 Jonathan Druart 2018-08-09 21:57:14 UTC
Created attachment 77636 [details] [review]
Bug 20504: Fix lang attribute in html tag on systempreferences page

On the system preferences page the lang attribute of the
html tag is always empty.

To test:
- Go to systempreferences
- Check the html source and look at the html tag,
  it should read: <html lang="">
- Apply patch
- Check the html source again: <html lang="en">
  Verify the language code shown matches the currently
  selected language in the staff interface
- Verify the language system preferences work correctly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The problem was actually that
  $lang = $template->param( 'lang' );
should certainly be $lang = $input->param( 'lang' );
and, as it, it overrides the value of 'lang' passed from C4::Auth
Comment 6 Josef Moravec 2018-08-21 16:16:23 UTC
Created attachment 78049 [details] [review]
Bug 20504: Fix lang attribute in html tag on systempreferences page

On the system preferences page the lang attribute of the
html tag is always empty.

To test:
- Go to systempreferences
- Check the html source and look at the html tag,
  it should read: <html lang="">
- Apply patch
- Check the html source again: <html lang="en">
  Verify the language code shown matches the currently
  selected language in the staff interface
- Verify the language system preferences work correctly

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
The problem was actually that
  $lang = $template->param( 'lang' );
should certainly be $lang = $input->param( 'lang' );
and, as it, it overrides the value of 'lang' passed from C4::Auth

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 7 Nick Clemens (kidclamp) 2018-08-22 15:00:59 UTC
Awesome work all!

Pushed to master for 18.11
Comment 8 Martin Renvoize (ashimema) 2018-08-24 10:44:52 UTC
Pushed to 18.05.x for 18.05.03
Comment 9 Fridolin Somers 2018-09-21 13:37:21 UTC
Pushed to 17.11.x for 17.11.10