From 0d3ddef93b0a72b824297e5504e435a4427f14bd Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sat, 3 Jan 2009 02:35:36 -0700 Subject: Started fleshing out reoganization of errors in errors.py (with gettext support) --- ipalib/request.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ipalib/request.py') diff --git a/ipalib/request.py b/ipalib/request.py index ea028239..5a07d4db 100644 --- a/ipalib/request.py +++ b/ipalib/request.py @@ -32,6 +32,12 @@ from constants import OVERRIDE_ERROR context = threading.local() +def _(message): + if hasattr(context, 'gettext'): + return context.gettext(message) + return message.decode('UTF-8') + + def set_languages(*languages): if hasattr(context, 'languages'): raise StandardError(OVERRIDE_ERROR % -- cgit