aboutsummaryrefslogtreecommitdiffstats
path: root/src/msec/config.py
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2010-02-08 14:05:56 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2010-02-08 14:05:56 +0000
commit00902a9d2085c63e28224d45db7737b01085d0f8 (patch)
tree67d6ede13384a2c3059815266de6c960ded79c9c /src/msec/config.py
parentaef359b11969f0ec52bb19d092fd3b9086a4cb38 (diff)
downloadmsec-00902a9d2085c63e28224d45db7737b01085d0f8.tar
msec-00902a9d2085c63e28224d45db7737b01085d0f8.tar.gz
msec-00902a9d2085c63e28224d45db7737b01085d0f8.tar.bz2
msec-00902a9d2085c63e28224d45db7737b01085d0f8.tar.xz
msec-00902a9d2085c63e28224d45db7737b01085d0f8.zip
Initial support for parameter value translation
Diffstat (limited to 'src/msec/config.py')
-rw-r--r--src/msec/config.py37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/msec/config.py b/src/msec/config.py
index 7669619..2e7726a 100644
--- a/src/msec/config.py
+++ b/src/msec/config.py
@@ -41,6 +41,32 @@ try:
except IOError:
_ = str
+# reverse translations
+# the strings for reverse translations are defined with N_ instead of _,
+# and are saved in config._translations{} with their reverse mapping
+# config._value_mapping{} stores the mapping between raw and translated
+# values in forward-compatible way
+_translations={}
+_value_mapping={}
+def N_(s):
+ """Translates string and stores the reverse mapping"""
+ trans = _(s)
+ _translations[trans] = s
+ _value_mapping[s] = trans
+ return trans
+
+def translate_to_raw(s):
+ """Recovers reverse mapping of a translated string (if any)"""
+ if s in _translations:
+ return _translations[s]
+ return s
+
+def translate_from_raw(s):
+ """Maps a value into its translated version"""
+ if s in _value_mappings:
+ return _value_mappings[s]
+ return s
+
# shared strings
MODIFICATIONS_FOUND = _('Modified system files')
MODIFICATIONS_NOT_FOUND = _('No changes in system files')
@@ -56,12 +82,17 @@ SETTINGS = {
'BASE_LEVEL': ("libmsec.base_level", ['*']),
}
# text for disabled options
-OPTION_DISABLED=_("System default")
+OPTION_DISABLED=N_("Disabled")
+
+# options for periodic checks
+VALUES_PERIODIC=[N_('manual'), N_('daily'), N_('weekly'), N_('monthly'), N_('no')]
+# options for yes-no checks
+VALUES_YESNO=[N_('yes'), N_('no')]
# some checks require installation of additional packages if a specific option was activated
REQUIRE_PACKAGES = {
- # the format is: 'OPTION_NAME': ('option value which requires package installation', 'list of packages')
- # for example, 'CHECK_CHKROOTKIT': ('yes', 'chkrootkit')
+ # the format is: 'OPTION_NAME': (['option values which requires package installation]', ['packages'])
+ # for example, 'CHECK_CHKROOTKIT': (['yes'], ['chkrootkit'])
}
# settings organizes by category