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 <d.csapak@proxmox.com>
use URI;
use URI::QueryParam;
use Data::Dumper;
+use PVE::Cluster;
use PVE::API2Tools;
use PVE::API2;
use PVE::APIServer::Formatter;
sub get_index {
my ($nodename, $server, $r, $args) = @_;
- my $lang = 'en';
+ my $lang;
my $username;
my $token = 'null';
}
}
+ 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;
<script type="text/javascript">
Proxmox = {
Setup: { auth_cookie_name: 'PVEAuthCookie' },
+ defaultLang: '[% lang %]',
UserName: '[% username %]',
CSRFPreventionToken: '[% token %]'
};
{
xtype: 'proxmoxLanguageSelector',
fieldLabel: gettext('Language'),
- value: Ext.util.Cookies.get('PVELangCookie') || 'en',
+ value: Ext.util.Cookies.get('PVELangCookie') || Proxmox.defaultLang || 'en',
name: 'lang',
reference: 'langField',
submitValue: false