Module: check_mk
Branch: master
Commit: 4fbb55159c0c76f4a89f2e00f993eddf42502e44
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4fbb55159c0c76…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Sep 19 13:29:16 2012 +0200
Introducted multisite config option hide_languages to remove available
languages from the multisite selection dialogs. To hide the builtin
english language simply add None to the list of hidden languages.
---
ChangeLog | 3 +++
web/htdocs/config.py | 6 ++++++
web/htdocs/wato.py | 2 +-
3 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index aa732de..743eb0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -109,6 +109,9 @@
* Sidebar: Sorting aggregation groups in BI snapin now
* Sidebar: Sorting sites in master control snapin case insensitive
* Added some missing localizations (error messages, view editor)
+ * Introducted multisite config option hide_languages to remove available
+ languages from the multisite selection dialogs. To hide the builtin
+ english language simply add None to the list of hidden languages.
* FIX: fixed localization of general permissions
* FIX: show multisite warning messages even after page reload
* FIX: fix bug in Age ValueSpec: days had been ignored
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index 48ad109..20a25c9 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -235,6 +235,9 @@ def get_language(default = None):
default = default_language
return user and user.get('language', default) or default
+def hide_language(lang):
+ return lang in hide_languages
+
def roles_of_user(user):
# Make sure, builtin roles are present, even if not modified
# and saved with WATO.
@@ -534,6 +537,9 @@ def load_default_values(into):
# Default language for l10n
into["default_language"] = None
+
+ # Hide these languages from user selection
+ into['hide_languages'] = []
# Default timestamp format to be used in multisite
into["default_ts_format"] = 'mixed'
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 949aaa6..eb5b17e 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -10650,7 +10650,7 @@ def register_rule(group, varname, valuespec = None, title = None,
#
def select_language(user_language):
- languages = get_languages()
+ languages = [ l for l in get_languages() if not config.hide_language(l[0]) ]
inactive = user_language != ''
if languages: