diff options
| author | bwarsaw | 2001-11-30 17:47:45 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-11-30 17:47:45 +0000 |
| commit | f3c9a22f0e571837e51fe820f9df90d00b0841b5 (patch) | |
| tree | 550331225b720574c5b5f783d9d37628550e6963 /Mailman/Cgi/options.py | |
| parent | bbe0f07f40d9cc36473866417f3700b67b6eb4f4 (diff) | |
| download | mailman-f3c9a22f0e571837e51fe820f9df90d00b0841b5.tar.gz mailman-f3c9a22f0e571837e51fe820f9df90d00b0841b5.tar.zst mailman-f3c9a22f0e571837e51fe820f9df90d00b0841b5.zip | |
main(): Move the setting of the language to up above the login page,
so that the selected language is propagated from the listinfo page to
the options login page. Also, grab the default language setting from
the form field.
loginpage(): Add a language selection widget.
Diffstat (limited to 'Mailman/Cgi/options.py')
| -rw-r--r-- | Mailman/Cgi/options.py | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/Mailman/Cgi/options.py b/Mailman/Cgi/options.py index be54f0daf..f12357250 100644 --- a/Mailman/Cgi/options.py +++ b/Mailman/Cgi/options.py @@ -76,6 +76,14 @@ def main(): # The total contents of the user's response cgidata = cgi.FieldStorage(keep_blank_values=1) + # Set the language for the page. If we're coming from the listinfo cgi, + # we might have a 'language' key in the cgi data. That was an explicit + # preference to view the page in, so we should honor that here. If that's + # not available, use the list's default language. + language = cgidata.getvalue('language', mlist.preferred_language) + i18n.set_language(language) + doc.set_language(language) + if lenparts < 2: user = cgidata.getvalue('email') if not user: @@ -85,11 +93,6 @@ def main(): else: user = Utils.LCDomain(Utils.UnobscureEmail(SLASH.join(parts[1:]))) - # Now we know which list is requested, so we can set the language to the - # list's preferred language. - i18n.set_language(mlist.preferred_language) - doc.set_language(mlist.preferred_language) - # Sanity check the user, but be careful about leaking membership # information when we're using private rosters. if not mlist.isMember(user) and mlist.private_roster == 0: @@ -657,15 +660,23 @@ def loginpage(mlist, doc, user, cgidata): title = _('%(realname)s list: member options for user %(user)s') obuser = Utils.ObscureEmail(user) extra = '' - # Set up the login page - form = Form(actionurl) - table = Table(width='100%', border=0, cellspacing=4, cellpadding=5) # Set up the title doc.SetTitle(title) + # We use a subtable here so we can put a language selection box in + lang = cgidata.getvalue('language', mlist.preferred_language) + table = Table(width='100%', border=0, cellspacing=4, cellpadding=5) + langform = Form(actionurl) + langform.AddItem(SubmitButton('displang-button', _('View this page in'))) + langform.AddItem(mlist.GetLangSelectBox(lang)) table.AddRow([Center(Header(2, title))]) table.AddCellInfo(table.GetCurrentRowIndex(), 0, bgcolor=mm_cfg.WEB_HEADER_COLOR) + table.AddRow([Center(langform)]) + doc.AddItem(table) # Preamble + # Set up the login page + form = Form(actionurl) + table = Table(width='100%', border=0, cellspacing=4, cellpadding=5) table.AddRow([_("""In order to change your membership option, you must first log in by giving your %(extra)smembership password in the section below. If you don't remember your membership password, you can have it |
