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):
197197 if any (x .endswith ('.mo' ) for x in os .listdir (locale_dir )):
198198 result .append (Locale .parse (folder ))
199199
200- result .append (self .default_locale )
200+ if self .default_locale not in result :
201+ result .append (self .default_locale )
201202 return result
202203
203204 @property
Original file line number Diff line number Diff line change @@ -96,6 +96,16 @@ def test_list_translations():
9696 assert str (translations [1 ]) == 'de_DE'
9797
9898
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+
99109def test_no_formatting ():
100110 """
101111 Ensure we don't format strings unless a variable is passed.
You can’t perform that action at this time.
0 commit comments