Fix loading list of languages after ex_cldr update

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-03-23 12:33:04 +01:00
parent ed4a55b4b6
commit e7ce24966b
No known key found for this signature in database
GPG key ID: A061B9DDE0CA0773

View file

@ -178,7 +178,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
def get_list_of_languages(_parent, %{codes: codes}, _resolution) when is_list(codes) do
locale = Mobilizon.Cldr.locale_or_default(Gettext.get_locale())
case Language.known_languages(locale) do
case Language.known_languages(String.to_existing_atom(locale)) do
data when is_map(data) ->
data
|> Enum.map(fn {code, elem} -> %{code: code, name: elem.standard} end)
@ -193,7 +193,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Admin do
def get_list_of_languages(_parent, _args, _resolution) do
locale = Gettext.get_locale()
case Language.known_languages(locale) do
case Language.known_languages(String.to_existing_atom(locale)) do
data when is_map(data) ->
data = Enum.map(data, fn {code, elem} -> %{code: code, name: elem.standard} end)
{:ok, data}