diff --git a/CHANGELOG b/CHANGELOG index 00829f9..219bdac 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,4 +5,5 @@ Major version bump as this version removes support for Python 3.5 and 3.6. - Dropped support for end-of-life Python 3.5 and 3.6, added tests for 3.10 and 3.11. - Fixes to documentation to address outdated links and settings (#204, 201) - Jinja version 3 or greater is now required (released 2021) -- Removed Babel._date_formats, use the public Babel.date_formats instead. \ No newline at end of file +- Removed Babel._date_formats, use the public Babel.date_formats instead. +- list_translations() always returns the default locale, even if it does not exist. (#75) \ No newline at end of file diff --git a/flask_babel/__init__.py b/flask_babel/__init__.py index 9de9432..731f191 100644 --- a/flask_babel/__init__.py +++ b/flask_babel/__init__.py @@ -137,6 +137,11 @@ def list_translations(self): """Returns a list of all the locales translations exist for. The list returned will be filled with actual locale objects and not just strings. + .. note:: + + The default locale will always be returned, even if no translation + files exist for it. + .. versionadded:: 0.6 """ result = [] @@ -153,10 +158,7 @@ def list_translations(self): if any(x.endswith('.mo') for x in os.listdir(locale_dir)): result.append(Locale.parse(folder)) - # If no other translations are found, add the default locale - if not result: - result.append(self.default_locale) - + result.append(self.default_locale) return result @property