summaryrefslogtreecommitdiff
path: root/Mailman/Utils.py
diff options
context:
space:
mode:
authorbwarsaw2000-12-26 19:52:00 +0000
committerbwarsaw2000-12-26 19:52:00 +0000
commitbdb6017365cef7ae26e6e2a8dc9cabc11842234a (patch)
treea2719df9a31fdcdc247c422df99eca18164b5ac2 /Mailman/Utils.py
parenta2fe5f77bd2b7b1c1097a968487a7958c4cabcfa (diff)
downloadmailman-bdb6017365cef7ae26e6e2a8dc9cabc11842234a.tar.gz
mailman-bdb6017365cef7ae26e6e2a8dc9cabc11842234a.tar.zst
mailman-bdb6017365cef7ae26e6e2a8dc9cabc11842234a.zip
maketext(): New optional parameter `lang' which is the language to
use. Maps to the language-specific subdirectory within the template directory.
Diffstat (limited to '')
-rw-r--r--Mailman/Utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Mailman/Utils.py b/Mailman/Utils.py
index f25dff557..9594bf7f5 100644
--- a/Mailman/Utils.py
+++ b/Mailman/Utils.py
@@ -491,16 +491,18 @@ class SafeDict(UserDict):
return '<Missing key: %s>' % `key`
-def maketext(templatefile, dict=None, raw=0):
+def maketext(templatefile, dict=None, raw=0, lang=None):
"""Make some text from a template file.
Reads the `templatefile', relative to mm_cfg.TEMPLATE_DIR, does string
substitution by interpolating in the `dict', and if `raw' is false,
wraps/fills the resulting text by calling wrap().
"""
+ if lang is None:
+ lang = mm_cfg.DEFAULT_SERVER_LANGUAGE
if dict is None:
dict = {}
- file = os.path.join(mm_cfg.TEMPLATE_DIR, templatefile)
+ file = os.path.join(mm_cfg.TEMPLATE_DIR, lang, templatefile)
fp = open(file)
template = fp.read()
fp.close()