Icingaweb2: browser language and timezone not used

Created on 16 Apr 2019  路  11Comments  路  Source: Icinga/icingaweb2

  • Icinga Web 2 v2.6.2, Git Commit 63cb9d7 + module-ipl v0.1.1
  • Apache v2.4.39
  • PHP v7.2.16
  • Gentoo Linux

Like #3607 - neither the browser language is considered nor the timezone determined correctly.

IcingaWebUser-201904161333

Default browser language is en_US but the site is localized de_DE (despite logout/login, empty cache, web server reload).
The (localhost) system time _and_ timezone is UTC and the PHP settings are correct:

/etc/php/apache2-php7.2/php.ini:date.timezone = UTC
/etc/php/fpm-php7.2/php.ini:date.timezone = UTC

Is the value 7200-1 really useful in cookie icingaweb2-tzo?

arelocalization bug

Most helpful comment

Thanks for all investigations!
Patch testet - good work:

| usr_setting | browser | result |
+-------------+---------+--------+
| browser     | en-US   | OK     |
| browser     | de-DE   | OK     |
| en_US       | en-US   | OK     |
| en_US       | de-DE   | OK     |
| de_DE       | en-US   | OK     |
| de_DE       | de-DE   | OK     |

All 11 comments

@MaBauMeBad can you please check that again?

@wols Hi, tested it and is still working in our Enviroment.

Browser detectes "Europe/Paris". I'm from germany. Since this is the same TImezone it is fine for me.

Is this maybe a bug, that it will always detect Paris now ?

Hi,

as @MaBauMeBad said, Europe/Paris is usually fine because it's the same timezone as Europe/Berlin. (as of now..) As long as the time is correct I wouldn't bother.

The language issue though is strange. Please show us what your browser is transmitting as part of the Accept-Language request header.

Firefox 66.0.2 (64bit)

Accept-Language: en-US,de-DE;q=0.7,en;q=0.3

Looks correct and produces the expected result. Your preference's config.ini would be the next step. What value has the language option there? (/etc/icingaweb2/preferences/wols/config.ini)

# /etc/icingaweb2/authentication.ini 
[icingaweb2]
backend = "db"
resource = "icingaweb2_db"
MariaDB [icingaweb2]> SELECT * FROM icingaweb_user_preference WHERE username = 'wols';
+----------+-----------+---------------------------------+--------+---------------------+---------------------+
| username | section   | name                            | value  | ctime               | mtime               |
+----------+-----------+---------------------------------+--------+---------------------+---------------------+
| wols     | icingaweb | auto_refresh                    | 1      | 2018-04-16 11:56:14 | 2018-04-16 11:56:14 |
| wols     | icingaweb | show_application_state_messages | system | 2019-04-16 07:59:12 | 2019-04-16 07:59:12 |
| wols     | icingaweb | show_benchmark                  | 0      | 2018-04-16 11:56:14 | 2018-04-16 11:56:14 |
| wols     | icingaweb | show_stacktraces                | 1      | 2018-04-16 11:56:14 | 2018-04-16 11:56:14 |
+----------+-----------+---------------------------------+--------+---------------------+---------------------+

The language and timezone keys are missing?
However, saving the user settings was confirmed without errors.

It's okay that they're missing. Web 2's configuration doesn't seem to be the problem here.

Any chance that your environment uses a default locale setting or a environment variable? (e.g. LC_ALL=de_DE)

Back from Easter holidays, comment follows...

Just managed to reproduce this (changing language has no effect) because others had the same issue.

It's due to the environment variable LANGUAGE. Once this is set any and all other settings are overridden and have no effect. Unsetting the variable solves the issue. Please check if this works for you.

Or you may try the PR I've just referenced.

Thanks for all investigations!
Patch testet - good work:

| usr_setting | browser | result |
+-------------+---------+--------+
| browser     | en-US   | OK     |
| browser     | de-DE   | OK     |
| en_US       | en-US   | OK     |
| en_US       | de-DE   | OK     |
| de_DE       | en-US   | OK     |
| de_DE       | de-DE   | OK     |
Was this page helpful?
0 / 5 - 0 ratings