summaryrefslogtreecommitdiff
path: root/Mailman/Gui/Language.py
diff options
context:
space:
mode:
authorbwarsaw2002-11-04 20:56:25 +0000
committerbwarsaw2002-11-04 20:56:25 +0000
commitc7398252c5f77a0df6369a95c1e5561835b1825f (patch)
tree76c360514d15fa35b381443fd1345deaea4e0a2b /Mailman/Gui/Language.py
parentb928b2345b7aef9d4bd06fe9f9fe3f4cf5e5223f (diff)
downloadmailman-c7398252c5f77a0df6369a95c1e5561835b1825f.tar.gz
mailman-c7398252c5f77a0df6369a95c1e5561835b1825f.tar.zst
mailman-c7398252c5f77a0df6369a95c1e5561835b1825f.zip
Diffstat (limited to 'Mailman/Gui/Language.py')
-rw-r--r--Mailman/Gui/Language.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Mailman/Gui/Language.py b/Mailman/Gui/Language.py
index 7b1c2b37c..a8598096c 100644
--- a/Mailman/Gui/Language.py
+++ b/Mailman/Gui/Language.py
@@ -17,6 +17,8 @@
"""MailList mixin class managing the language options.
"""
+import codecs
+
from Mailman import mm_cfg
from Mailman import Utils
from Mailman import i18n
@@ -34,6 +36,7 @@ class Language(GUIBase):
def GetConfigInfo(self, mlist, category, subcat=None):
if category <> 'language':
return None
+
# Set things up for the language choices
langs = mlist.GetAvailableLanguages()
langnames = [_(Utils.GetLanguageDescr(L)) for L in langs]
@@ -44,7 +47,17 @@ class Language(GUIBase):
# be other trouble lurking!
langi = 0
- all = mm_cfg.LC_DESCRIPTIONS.keys()
+ # Only allow the admin to choose a language if the system has a
+ # charset for it. I think this is the best way to test for that.
+ def checkcodec(charset):
+ try:
+ codecs.lookup(charset)
+ return 1
+ except LookupError:
+ return 0
+
+ all = [key for key in mm_cfg.LC_DESCRIPTIONS.keys()
+ if checkcodec(Utils.GetCharSet(key))]
all.sort()
checked = [L in langs for L in all]
allnames = [_(Utils.GetLanguageDescr(L)) for L in all]