From f4aa76c54950c21b730e55dfc2ed87f34441ba11 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 17 Aug 2018 09:26:21 +0200 Subject: [PATCH] fix #1393: use language from datacenter.cfg for gui if we do not have a language cookie, try to read the language from the datacenter.cfg and fall back to 'en' also set it into the 'Proxmox' object, so that the gui can show it in the LoginWindow Signed-off-by: Dominik Csapak --- PVE/Service/pveproxy.pm | 8 +++++++- www/index.html.tpl | 1 + www/manager6/window/LoginWindow.js | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/PVE/Service/pveproxy.pm b/PVE/Service/pveproxy.pm index b092438a..bb60b29e 100755 --- a/PVE/Service/pveproxy.pm +++ b/PVE/Service/pveproxy.pm @@ -10,6 +10,7 @@ use Encode; use URI; use URI::QueryParam; use Data::Dumper; +use PVE::Cluster; use PVE::API2Tools; use PVE::API2; use PVE::APIServer::Formatter; @@ -176,7 +177,7 @@ sub is_phone { sub get_index { my ($nodename, $server, $r, $args) = @_; - my $lang = 'en'; + my $lang; my $username; my $token = 'null'; @@ -192,6 +193,11 @@ sub get_index { } } + if (!$lang) { + my $dc_conf = PVE::Cluster::cfs_read_file('datacenter.cfg'); + $lang = $dc_conf->{language} // 'en'; + } + $username = '' if !$username; my $mobile = is_phone($r->header('User-Agent')) ? 1 : 0; diff --git a/www/index.html.tpl b/www/index.html.tpl index a972e3aa..ae7f610f 100644 --- a/www/index.html.tpl +++ b/www/index.html.tpl @@ -26,6 +26,7 @@