Open blinry opened 1 year ago
Hi @blinry, thanks for the report. I haven't tried building the bundle without extracting beforehand, but I'd say it's indeed expected to at least run lingui extract
every time there is a new string so that the dictionary is updated and you can start filling in the translations. Do you have a use case for which you don't want to extract the strings before building/deploying them?
Since extraction is an important step in working with lingui, I'd suggest always running lingui extract
, and set up some helpers to do this for you automatically on certain steps. I'd usually put it on a git pre-commit hook, and you can also have the hook cancel the commit if there are untranslated strings (which is usually the case if there are strings that haven't been extracted before.
Lingui for React behaves the same way; you need to run lingui extract
first. So if this was going to be fixed, it should be fixed in the main lingui repo, not the integration.
After running
vite build
and looking at the deployed version, translated strings for whichlingui extract
has not yet been run don't seem to have replaced placeholders. For example, they show up like this on the website: "Count: {0}"In comparison, in the
vite dev
version, they show up correctly, like "Count: 0". So I'd expect this to happen in the deployed version, as well.Can you reproduce this? Otherwise, I can also provide a minimal example!
And another question is whether this can/should be fixed. A workaround would be to always run
lingui extract
beforevite build
.