Translate options for an input field of type select

Disclaimer: I am not good at frontend design…
Let’s say I have a list of atoms used in an ecto schema:

@groups ~w(group_a group_b group_c)a
field :groupname, Ecto.Enum, values: @groups

Since I need something like this:

options={[
  {gettext("Group A"), group_a},
  {gettext("Group B"), group_b},
  {gettext("Group C"), group_c}
]}

I am thinking of building the options dynamically and call

Gettext.dgettext(BackendWeb.Gettext, "options", msg)

on each

I can’t make up my mind how to handle this
Are there easier(more elegant) solution I might have missed?

How are you handling these kind of translations?

I don’t think there is a workaround for this as every language is different, usually you don’t want to split translations into separate parts of sentence as they will lose meaning, just like google used to translate back in the day.

Perfectly, in your case the group names are variables, so you would want use gettext in this way: Gettext usage with cariable in the middle of a sentence - #2 by LostKobrakai.