From 056b6a968fb3f96ba3bf4dcc00b82370c043154e Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Sat, 27 Feb 2016 20:38:34 -0800 Subject: Added switch to disable the l10n cset recoding. --- Mailman/Defaults.py.in | 7 +++++++ Mailman/i18n.py | 11 ++++++++--- NEWS | 5 ++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Mailman/Defaults.py.in b/Mailman/Defaults.py.in index 06b3e0ad..04d7db8a 100755 --- a/Mailman/Defaults.py.in +++ b/Mailman/Defaults.py.in @@ -153,6 +153,13 @@ ACCEPTABLE_LISTNAME_CHARACTERS = '[-+_.=a-z0-9]' # in list rosters? Defaults to No to preserve prior behavior. ROSTER_DISPLAY_REALNAME = No +# Beginning in Mailman 2.1.21, localized help and some other output from +# Mailman's bin/ commands is converted to the character set of the user's +# workstation (LC_CTYPE) if different from the character set of the language. +# This is not well tested over a wide range of locales, so if it causes +# problems, it can be disabled by setting the following to Yes. +DISABLE_COMMAND_LOCALE_CSET = No + ##### diff --git a/Mailman/i18n.py b/Mailman/i18n.py index 102bee83..b8b527e0 100644 --- a/Mailman/i18n.py +++ b/Mailman/i18n.py @@ -33,7 +33,8 @@ def _get_ctype_charset(): locale.setlocale(locale.LC_CTYPE, old) return charset -_ctype_charset = _get_ctype_charset() +if not mm_cfg.DISABLE_COMMAND_LOCALE_CSET: + _ctype_charset = _get_ctype_charset() @@ -114,8 +115,12 @@ def tolocale(s): return s return unicode(s, source, 'replace').encode(_ctype_charset, 'replace') -def C_(s): - return tolocale(_(s, 2)) +if mm_cfg.DISABLE_COMMAND_LOCALE_CSET: + C_ = _ +else: + def C_(s): + return tolocale(_(s, 2)) + def ctime(date): diff --git a/NEWS b/NEWS index c7092b8b..1047b272 100644 --- a/NEWS +++ b/NEWS @@ -39,7 +39,10 @@ Here is a history of user visible changes to Mailman. - Also thanks to Miloslav Trmac and Yasuhito FUTATSUKI, the l10n for Mailman's bin/ commands has been fixed to display using the character set of the user's work station even when Mailman's character set for - the language is different. (LP: #558167) + the language is different. Because this has not been tested over a + wide set of locales, there is an mm_cfg.py switch + DISABLE_COMMAND_LOCALE_CSET to disable it if it causes problems. + (LP: #558167) - The Polish translation has been updated by Stefan Plewako. -- cgit v1.2.3