File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,8 @@ def list_translations(self):
197
197
if any (x .endswith ('.mo' ) for x in os .listdir (locale_dir )):
198
198
result .append (Locale .parse (folder ))
199
199
200
- result .append (self .default_locale )
200
+ if self .default_locale not in result :
201
+ result .append (self .default_locale )
201
202
return result
202
203
203
204
@property
Original file line number Diff line number Diff line change @@ -96,6 +96,16 @@ def test_list_translations():
96
96
assert str (translations [1 ]) == 'de_DE'
97
97
98
98
99
+ def test_list_translations_default_locale_exists ():
100
+ app = flask .Flask (__name__ )
101
+ b = babel .Babel (app , default_locale = 'de' )
102
+
103
+ with app .app_context ():
104
+ translations = b .list_translations ()
105
+ assert len (translations ) == 1
106
+ assert str (translations [0 ]) == 'de'
107
+
108
+
99
109
def test_no_formatting ():
100
110
"""
101
111
Ensure we don't format strings unless a variable is passed.
You can’t perform that action at this time.
0 commit comments