[Mpuls-commits] r5360 - base/trunk/mpulsweb/lib
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Sep 15 19:44:36 CEST 2011
Author: bh
Date: 2011-09-15 19:44:36 +0200 (Thu, 15 Sep 2011)
New Revision: 5360
Modified:
base/trunk/mpulsweb/lib/dialogs.py
Log:
Avoid translate text while importing a module.
Move the translation into the functions where they are used instead.
Modified: base/trunk/mpulsweb/lib/dialogs.py
===================================================================
--- base/trunk/mpulsweb/lib/dialogs.py 2011-09-15 17:30:02 UTC (rev 5359)
+++ base/trunk/mpulsweb/lib/dialogs.py 2011-09-15 17:44:36 UTC (rev 5360)
@@ -12,8 +12,6 @@
from mpulsweb.lib.helpers import url_for
from mpulsweb.model.appointment import CaseAppointmentFactory
-CONFIRM_DEFAULT_HEADER = _('Default Header')
-CONFIRM_DEFAULT_TEXT = _('Default Text')
CONFIRM_DEFAULT_URL_ABORT = '/index'
DIALOGS_ENABLED = True
@@ -88,11 +86,11 @@
def render_confirm(header=None, text=None, url_ok=None, url_abort=None,
dyntext=None):
"""Returns the rendered confirm dialog"""
- c.dialog_title = header or CONFIRM_DEFAULT_HEADER
+ c.dialog_title = header or _('Default Header')
if dyntext and text:
c.dialog_text = text % dyntext
else:
- c.dialog_text = text or CONFIRM_DEFAULT_TEXT
+ c.dialog_text = text or _('Default Text')
c.url_ok = url_ok
c.url_abort = url_abort or url_for(controller="meta", action="index")
return render('/dialogs/confirm_%s.mako' % get_dialog_template())
@@ -100,22 +98,22 @@
def render_success(header=None, text=None, url_ok=None, dyntext=None):
"""Returns the rendered success dialog"""
- c.dialog_title = header or CONFIRM_DEFAULT_HEADER
+ c.dialog_title = header or _('Default Header')
if dyntext and text:
c.dialog_text = text % dyntext
else:
- c.dialog_text = text or CONFIRM_DEFAULT_TEXT
+ c.dialog_text = text or _('Default Text')
c.url_ok = url_ok
return render('/dialogs/success_%s.mako' % get_dialog_template())
def render_error(header=None, text=None, url_ok=None, dyntext=None):
"""Returns the rendered error dialog"""
- c.dialog_title = header or CONFIRM_DEFAULT_HEADER
+ c.dialog_title = header or _('Default Header')
if dyntext and text:
c.dialog_text = text % dyntext
else:
- c.dialog_text = text or CONFIRM_DEFAULT_TEXT
+ c.dialog_text = text or _('Default Text')
c.url_ok = url_ok
return render('/dialogs/error_%s.mako' % get_dialog_template())
More information about the Mpuls-commits
mailing list