diff options
| author | bwarsaw | 2001-05-18 20:14:53 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-05-18 20:14:53 +0000 |
| commit | 99bf4f49b61b79f8af5a7a9e609b4ac1b3fe231d (patch) | |
| tree | 50be09adfc735966ef8df7d44b61a0c4cbd14955 /Mailman/i18n.py | |
| parent | 7a8f2a6322f8ec7b67021dbec84d56bb874a3075 (diff) | |
| download | mailman-99bf4f49b61b79f8af5a7a9e609b4ac1b3fe231d.tar.gz mailman-99bf4f49b61b79f8af5a7a9e609b4ac1b3fe231d.tar.zst mailman-99bf4f49b61b79f8af5a7a9e609b4ac1b3fe231d.zip | |
Diffstat (limited to 'Mailman/i18n.py')
| -rw-r--r-- | Mailman/i18n.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Mailman/i18n.py b/Mailman/i18n.py index 2dcacadc9..c1bb82249 100644 --- a/Mailman/i18n.py +++ b/Mailman/i18n.py @@ -20,21 +20,22 @@ import gettext from Mailman import mm_cfg from Mailman.SafeDict import SafeDict +_translation = None - -_translation = gettext.NullTranslations() -def set_language(language): + +def set_language(language=None): global _translation + if language is not None: + language = [language] try: _translation = gettext.translation('mailman', mm_cfg.MESSAGES_DIR, - [language]) + language) except IOError: # The selected language was not installed in messages, so fall back to # untranslated English. _translation = gettext.NullTranslations() - def get_translation(): return _translation @@ -43,6 +44,12 @@ def set_translation(translation): _translation = translation +# Set up the global translation based on environment variables. Mostly used +# for command line scripts. +if _translation is None: + set_language() + + def _x(s, frame): # Do translation of the given string into the current language, and do |
