Merge lp:~futatuki/mailman/i18n-add-whence-to-adminack-templates into lp:mailman/2.1
Status: | Merged |
---|---|
Merged at revision: | 1776 |
Proposed branch: | lp:~futatuki/mailman/i18n-add-whence-to-adminack-templates |
Merge into: | lp:mailman/2.1 |
Diff against target: |
200 lines (+25/-14) 7 files modified
Mailman/Bouncer.py (+2/-1) Mailman/Cgi/admin.py (+5/-3) Mailman/Cgi/options.py (+2/-1) Mailman/ListAdmin.py (+3/-1) Mailman/MailList.py (+8/-6) Mailman/i18n.py (+4/-1) messages/Makefile.in (+1/-1) |
To merge this branch: | bzr merge lp:~futatuki/mailman/i18n-add-whence-to-adminack-templates |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mark Sapiro | Approve | ||
Review via email: mp+348127@code.launchpad.net |
Commit message
i18nize whence candidate message strings
Description of the change
This is a solution of problem left in mp+347992.
To mark whence messages for pygettext, I introduced dummy function i18n.D_(s) returns s it self, and then added "-k D_" option to pygettext commandline in messages/
This costs extra function call on execute, for its maintenancebility.
I've picked up whence candidate message strings except from bin/add_member, bin/delete_member, and cron/disabled, and tested with ja translation (temporary for test, not included in this proposal).
Note:
* whence messages for user conformation of subscribe and unsubscribe are inconsistent. For subscribe they are 'via email confirmation' and 'via web confirmation', but for unsubscribe they are 'email confirmation' and 'web confirmation'.
* admin approval for unsubscription dosen't report whence because ListAdmin.
I'm going to merge this although somewhat differently. I like what you have done and it is conceptually similar to what we do in Mailman 3. There, we have augmented i18n._ with a context manager to not do the translation and then we can do things like:
with _.defer_ translation( ):
msgdata. setdefault( 'moderation_ reasons' , []).append(
_( 'Message contains administrivia'))
# This will be translated at the point of use.
to mark messages without translating them. However, there are already many places in Mailman 2.1 where we accomplish a similar thing by doing things like:
def _(s):
return s
_('string to translate later')
_ = i18n._
In fact, for example, in Mailman/Bouncer.py we already have
def _(s): return s
REASONS = {MemberAdaptor. BYBOUNCE: _('due to excessive bounces'),
MemberAdapt or.BYUSER: _('by yourself'),
MemberAdapt or.BYADMIN: _('by the list administrator'),
MemberAdapt or.UNKNOWN: _('for unknown reasons'),
}
_ = i18n._
To to be more consistent with what is done elsewhere in the code, rather than defining D_() in i18n, I'll define it in the places it's needed and then just do things like
_ = D_
_('string to translate later')
_ = i18n._
Your way is actually better, but in this case, I think it's more important to maintain consistency