Пример #1
0
 def GetStandardReplacements(self, lang=None):
     dmember_len = len(self.getDigestMemberKeys())
     member_len = len(self.getRegularMemberKeys())
     # If only one language is enabled for this mailing list, omit the
     # language choice buttons.
     if len(self.GetAvailableLanguages()) == 1:
         listlangs = _(Utils.GetLanguageDescr(self.preferred_language))
     else:
         listlangs = self.GetLangSelectBox(lang).Format()
     d = {
         '<mm-mailman-footer>' : self.GetMailmanFooter(),
         '<mm-list-name>' : self.real_name,
         '<mm-email-user>' : self._internal_name,
         '<mm-list-description>' : Utils.websafe(self.description),
         '<mm-list-info>' : 
             '<!---->' + BR.join(self.info.split(NL)) + '<!---->',
         '<mm-form-end>'  : self.FormatFormEnd(),
         '<mm-archive>'   : self.FormatArchiveAnchor(),
         '</mm-archive>'  : '</a>',
         '<mm-list-subscription-msg>' : self.FormatSubscriptionMsg(),
         '<mm-restricted-list-message>' : \
             self.RestrictedListMessage(_('The current archive'),
                                        self.archive_private),
         '<mm-num-reg-users>' : `member_len`,
         '<mm-num-digesters>' : `dmember_len`,
         '<mm-num-members>' : (`member_len + dmember_len`),
         '<mm-posting-addr>' : '%s' % self.GetListEmail(),
         '<mm-request-addr>' : '%s' % self.GetRequestEmail(),
         '<mm-owner>' : self.GetOwnerEmail(),
         '<mm-reminder>' : self.FormatReminder(self.preferred_language),
         '<mm-host>' : self.host_name,
         '<mm-list-langs>' : listlangs,
         }
Пример #2
0
    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]
        try:
            langi = langs.index(mlist.preferred_language)
        except ValueError:
            # Someone must have deleted the list's preferred language.  Could
            # be other trouble lurking!
            langi = 0

        # 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 list(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]

        return [
            _('Natural language (internationalization) options.'),

            ('preferred_language', mm_cfg.Select,
             (langs, langnames, langi),
             0,
             _('Default language for this list.'),
             _('''This is the default natural language for this mailing list.
             If <a href="?VARHELP=language/available_languages">more than one
             language</a> is supported then users will be able to select their
             own preferences for when they interact with the list.  All other
             interactions will be conducted in the default language.  This
             applies to both web-based and email-based messages, but not to
             email posted by list members.''')),

            ('available_languages', mm_cfg.Checkbox,
             (allnames, checked, 0, all), 0,
             _('Languages supported by this list.'),

             _('''These are all the natural languages supported by this list.
             Note that the
             <a href="?VARHELP=language/preferred_language">default
             language</a> must be included.''')),

            ('encode_ascii_prefixes', mm_cfg.Radio,
             (_('Never'), _('Always'), _('As needed')), 0,
             _("""Encode the
             <a href="?VARHELP=general/subject_prefix">subject
             prefix</a> even when it consists of only ASCII characters?"""),

             _("""If your mailing list's default language uses a non-ASCII
             character set and the prefix contains non-ASCII characters, the
             prefix will always be encoded according to the relevant
             standards.  However, if your prefix contains only ASCII
             characters, you may want to set this option to <em>Never</em> to
             disable prefix encoding.  This can make the subject headers
             slightly more readable for users with mail readers that don't
             properly handle non-ASCII encodings.

             <p>Note however, that if your mailing list receives both encoded
             and unencoded subject headers, you might want to choose <em>As
             needed</em>.  Using this setting, Mailman will not encode ASCII
             prefixes when the rest of the header contains only ASCII
             characters, but if the original header contains non-ASCII
             characters, it will encode the prefix.  This avoids an ambiguity
             in the standards which could cause some mail readers to display
             extra, or missing spaces between the prefix and the original
             header.""")),

            ]