diff options
Diffstat (limited to 'Mailman/Gui/Language.py')
| -rw-r--r-- | Mailman/Gui/Language.py | 15 |
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] |
