Update get_supported_locales to return a JSON serializable result

This commit is contained in:
nucleogenic 2022-09-10 02:58:47 +01:00
parent edf65a8768
commit 4ef2e20b4f
No known key found for this signature in database
GPG Key ID: 04A5E4E319C4271D

View File

@ -89,10 +89,12 @@ def get_supported_locales():
""" """
Returns a list of Locale objects that the Web Interfaces supports Returns a list of Locale objects that the Web Interfaces supports
""" """
locales = BABEL.list_translations() locales = [
locales.append(Locale("en")) {"language": x.language, "display_name": x.display_name}
sorted_locales = sorted(locales, key=lambda x: x.language) for x in [*BABEL.list_translations(), Locale("en")]
return sorted_locales ]
return sorted(locales, key=lambda x: x["language"])
# pylint: disable=too-many-locals # pylint: disable=too-many-locals