Fix lang html variable on config page

This commit is contained in:
shortcutme 2019-03-18 01:06:45 +01:00
parent e77d63294e
commit a620bf2174
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 4 additions and 1 deletions

View file

@ -63,7 +63,6 @@ class UiRequestPlugin(object):
data = translate.translateData(data, site.storage.loadJson(lang_file), "js")
else:
data = translate.translateData(data, site.storage.loadJson(lang_file), "html")
data = data.replace(b"lang={lang}", b"lang=%s" % translate.lang.encode("utf8")) # lang get parameter to .js file to avoid cache
except Exception as err:
site.log.error("Error loading translation file %s: %s" % (lang_file, err))

View file

@ -126,6 +126,10 @@ class Translate(dict):
else:
pattern = '"(' + "|".join(patterns) + ')"'
data = re.sub(pattern, replacer, data)
if mode == "html":
data = data.replace("lang={lang}", "lang=%s" % self.lang) # lang get parameter to .js file to avoid cache
return data
translate = Translate()