Skip to content

Commit 1cb2350

Browse files
author
Alexander Smishlajev
committed
straighten "if not ... else" logic;
fix: main message catalog was also used as fallback
1 parent 5af880f commit 1cb2350

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

roundup/i18n.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: i18n.py,v 1.11 2004-10-23 14:03:34 a1s Exp $
18+
# $Id: i18n.py,v 1.12 2004-10-23 14:20:57 a1s Exp $
1919

2020
"""
2121
RoundUp Internationalization (I18N)
@@ -164,10 +164,10 @@ def get_translation(language=None, tracker_home=None,
164164
mofiles = []
165165
# locale directory paths
166166
system_locale = gettext_module._default_localedir
167-
if tracker_home is not None:
168-
tracker_locale = os.path.join(tracker_home, "locale")
169-
else:
167+
if tracker_home is None:
170168
tracker_locale = None
169+
else:
170+
tracker_locale = os.path.join(tracker_home, "locale")
171171
# get the list of locales
172172
locales = find_locales(language)
173173
# add mofiles found in the tracker, then in the system locale directory
@@ -185,7 +185,9 @@ def get_translation(language=None, tracker_home=None,
185185
mofiles = filter(None, mofiles)
186186
if mofiles:
187187
translator = translation_class(open(mofiles[0], "rb"))
188-
for mofile in mofiles:
188+
for mofile in mofiles[1:]:
189+
# note: current implementation of gettext_module
190+
# always adds fallback to the end of the fallback chain.
189191
translator.add_fallback(translation_class(open(mofile, "rb")))
190192
else:
191193
translator = null_translation_class()

0 commit comments

Comments
 (0)