Bug 20504 - Language attribute in html tag is empty in system preference editor
Summary: Language attribute in html tag is empty in system preference editor
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Katrin Fischer
QA Contact: Josef Moravec
URL:
Keywords:
: 19591 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-03-31 07:19 UTC by Katrin Fischer
Modified: 2019-10-14 19:58 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 20504: Fix lang attribute in html tag on systempreferences page (1.84 KB, patch)
2018-08-09 17:49 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 20504: Fix lang attribute in html tag on systempreferences page (2.10 KB, patch)
2018-08-09 21:57 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 20504: Fix lang attribute in html tag on systempreferences page (2.15 KB, patch)
2018-08-21 16:16 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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 2018-08-22 15:00:59 UTC
Awesome work all!

Pushed to master for 18.11
Comment 8 Martin Renvoize 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