How to interpolate HEEx components within gettext output?

Hello! I am trying to convert all the UI strings in the HEEx generated via phx.gen.auth to use gettext. However, I’m running into trouble with strings that have components within them.

I thought that maybe something like this would work, but I realize that I’m already within the context of the H sigil, so I get a SyntaxError.

<%= gettext("Don't have an account? %{sign_up} for an account now",
  sign_up: ~H"""
    <.link navigate={~p"/users/register"} class="font-semibold text-brand hover:underline">
      <%= gettext("Sign up") %>
    </.link>
    """
) %>

I tried some of the stuff mentioned in this topic about HTML interpolation, but it doesn’t seem to work. Any advice/tips? :man_bowing:

Good question! I’m not sure if/how that’s possible, so may I suggest this workaround:

<%= gettext("Don't have an account?") %>
<.link navigate={~p"/users/register"} class="font-semibold text-brand hover:underline">
   <%= gettext("Sign up") %>
</.link>
<%= gettext("%{sign_up} for an account now", sign_up: "") %>