Sharing a not-much-elegate way to implement i18n in Phoenix LiveView (can you help improve it?)

To extend @LostKobrakai’s advice since you discovered Routex:

Routex gets the locale information from a configurable variety of sources. This allows navigation with the proper locale every time. When fully loading a page using navigate, the whole page is re-rendered so all is good by default. When using patch you might need some cheats.

 <%!-- Because we use `patch`, we need a workaround to force LV to refresh this element
        entirely as it contains Gettext translated strings in template (so their changes are not tracked) --%>

<%= Gettext.with_locale(@runtime.language, fn -> %>
  <h1>Localization</h1>
  <p>
    Routex' Localization extensions are highly customizable. This example page does not even scratch
    the surface of what is possible. Here are a few notable features making them unique:
  </p>
<% end %>

Or to force update links on navigation when using ‘patch’:

  # @url in the navigate links forces them to update when switching region
  # using '<.link patch={~p"/my/url"}`. It is adviced to use 'navigate' instead
  # of `patch` to simply full refresh the page when switching regions."
 <li><.link navigate={@url && ~p"/localize"} class="btn btn-ghost">Localize</.link></li>
 <li><.link navigate={@url && ~p"/verified"} class="btn btn-ghost">Verified Routes</.link></li>
 <li><.link navigate={@url && ~p"/cloak/products"} class="btn btn-ghost">Cloak</.link></li>