Module: check_mk
Branch: master
Commit: 4291b081bcfe4045981376af557ce8ec3a914426
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4291b081bcfe40…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue May 10 11:13:09 2016 +0200
Make localized strings work in non localized context
---
lib/exceptions.py | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lib/exceptions.py b/lib/exceptions.py
index 3f6ab91..fe74d3b 100644
--- a/lib/exceptions.py
+++ b/lib/exceptions.py
@@ -24,6 +24,16 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+# TODO: Clean this up one day by using the way recommended by gettext.
+# (See
https://docs.python.org/2/library/gettext.html). For this we
+# need the path to the locale files here.
+try:
+ _
+except NameError:
+ _ = lambda x: x # Fake i18n when not available
+
+
# never used directly in the code. Just some wrapper to make all of our
# exceptions handleable with one call
class MKException(Exception):