[3635][WebUI] fix language change to system default

When setting a language, we set 2 environment variables at run time.
Setting the language back to `System Default`, we don't clean those env
variables.
In the WebUI, the page only reloads, and we still use the env variables
to set the language back to the previous one.
This does not affect GTK.

Closes: https://dev.deluge-torrent.org/ticket/3635
Closes: https://github.com/deluge-torrent/deluge/pull/450
This commit is contained in:
DjLegolas 2024-05-02 01:23:51 +03:00 committed by Calum Lind
parent 322faa7a54
commit 18fa028d2d
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
1 changed files with 3 additions and 0 deletions

View File

@ -66,6 +66,9 @@ def set_language(lang):
:type lang: str :type lang: str
""" """
if not lang: if not lang:
for lang_env_var in ['LANGUAGE', 'LANG']:
if lang_env_var in os.environ:
del os.environ[lang_env_var]
return return
# Necessary to set these environment variables for GtkBuilder # Necessary to set these environment variables for GtkBuilder