Module: check_mk
Branch: master
Commit: eae3370390aa643011c773d22ac9179e42187324
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eae3370390aa64…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jul 8 15:39:54 2016 +0200
3668 FIX Fixed slow loading of GUI pages when using a localized GUI
---
.werks/3668 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/i18n.py | 1 +
web/htdocs/index.py | 4 ++--
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.werks/3668 b/.werks/3668
new file mode 100644
index 0000000..871c988
--- /dev/null
+++ b/.werks/3668
@@ -0,0 +1,10 @@
+Title: Fixed slow loading of GUI pages when using a localized GUI
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.4.0i1
+Date: 1467985155
+
+
diff --git a/ChangeLog b/ChangeLog
index 9922844..a1d2e69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -387,6 +387,7 @@
* 3148 FIX: fixed Edit View/Dashlet Dialogs offering non-sensical filter choices...
* 3659 FIX: Fixed GUI exceptions for users having special characters in ther user
names
* 3662 FIX: Fixed creation/editing of dashboards (regression since 1.2.8p5)
+ * 3668 FIX: Fixed slow loading of GUI pages when using a localized GUI
WATO:
* 3244 WATO BI Module: swap order of aggregation function and child node
selection...
diff --git a/web/htdocs/i18n.py b/web/htdocs/i18n.py
index d9f8ede..e1a3c6e 100644
--- a/web/htdocs/i18n.py
+++ b/web/htdocs/i18n.py
@@ -109,6 +109,7 @@ def init_language(lang, domain="multisite",
locale_path=None):
# Prepares the builtin-scope for localization, registers the _() function and
# current_language variable. Is also used to disable localization
def unlocalize():
+ # TODO: Make behaviour like gettext _(): Always return unicode strings
__builtin__._ = lambda x: x
__builtin__.current_language = None
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index 7f38224..ab7342b 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -43,7 +43,6 @@ def handler(req, fields = None, is_profiling = False):
response_code = apache.OK
try:
- i18n.initialize()
config.load_config() # load multisite.mk etc.
init_profiling(is_profiling)
html.init_modes()
@@ -108,12 +107,13 @@ def handler(req, fields = None, is_profiling = False):
# Initialize the multiste i18n. This will be replaced by
# language settings stored in the user profile after the user
# has been initialized
+ previous_language = current_language
i18n.localize(html.var("lang", config.get_language()))
# All plugins might have to be reloaded due to a language change. Only trigger
# a second plugin loading when the user is really using a custom localized GUI.
# Otherwise the load_all_plugins() at the beginning of the request is
sufficient.
- if current_language != None:
+ if current_language != previous_language:
modules.load_all_plugins()
# User allowed to login at all?