Allow to change language configuration parameter, reload translate files on change
This commit is contained in:
parent
0f31f1d34a
commit
8ad6cd2e81
1 changed files with 12 additions and 1 deletions
|
@ -714,9 +714,20 @@ class UiWebsocket(object):
|
||||||
sys.modules["main"].ui_server.stop()
|
sys.modules["main"].ui_server.stop()
|
||||||
|
|
||||||
def actionConfigSet(self, to, key, value):
|
def actionConfigSet(self, to, key, value):
|
||||||
if key not in ["tor"]:
|
if key not in ["tor", "language"]:
|
||||||
self.response(to, {"error": "Forbidden"})
|
self.response(to, {"error": "Forbidden"})
|
||||||
return
|
return
|
||||||
|
|
||||||
config.saveValue(key, value)
|
config.saveValue(key, value)
|
||||||
|
|
||||||
|
if key == "language":
|
||||||
|
import Translate
|
||||||
|
for translate in Translate.translates:
|
||||||
|
translate.setLanguage(value)
|
||||||
|
self.cmd("notification", ["done",
|
||||||
|
_["You have successfully changed the web interface's language!"] + "<br>" +
|
||||||
|
_["Due to the browser's caching, the full transformation could take some minute."]
|
||||||
|
, 10000])
|
||||||
|
config.language = value
|
||||||
|
|
||||||
self.response(to, "ok")
|
self.response(to, "ok")
|
||||||
|
|
Loading…
Reference in a new issue