to extract and merge all gettext references to our .pot and .po files.
These references never get picked up. I could add the msgid and msgstr manually, but those are overwritten when extracting and merging again.
Is there some configuration setting that I’m missing? A place I forgot to import Gettext?
I think I found the solution while testing the reply of @wmnnd
Apparently, you need to import import YourAppWeb.Gettext into the corresponding live module of the leex template.
Works:
defmodule YourAppWeb.SomethingLive do
use Phoenix.LiveView
use Phoenix.HTML
import YourAppWeb.Gettext
def mount(_, _, socket) do
{:ok, socket}
end
end
<%= gettext("Entiteit") %>
Does not work:
defmodule YourAppWeb.SomethingLive do
use Phoenix.LiveView
use Phoenix.HTML
# import YourAppWeb.Gettext
def mount(_, _, socket) do
{:ok, socket}
end
end
<%= gettext("Entiteit") %>
Stumbled across your message a bit late, but maybe my findings are still helpful, or helpful to others – I had the same error when mistakenly doing something like this:
defmodule FooWeb.SomeComponent
use Phoenix.LiveComponent
# ...
end
Instead, you are supposed to use the macros generated for you:
defmodule FooWeb.SomeComponent
use FooWeb, :live_component
# ...
end
This way, all view helpers are imported – basically that is everything the use FooWeb, :live_component macro does (at least in code generated using liveview version 0.15.5) in addition to use Phoenix.LiveComponent, so it takes some time until you find out that you have some functionality missing.