Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When deploying without lingui extract, placeholders in translated strings are not replaced #8

Open
blinry opened this issue Nov 2, 2023 · 2 comments

Comments

@blinry
Copy link

blinry commented Nov 2, 2023

After running vite build and looking at the deployed version, translated strings for which lingui 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 before vite build.

@HenryLie
Copy link
Owner

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.

@ptmkenny
Copy link

ptmkenny commented Aug 1, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants