-
Notifications
You must be signed in to change notification settings - Fork 393
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
Lingui ignores whitespace in multi-item Trans tags #525
Comments
Hi @aldeka, sorry for problems. This issue is already fixed in js-lingui/packages/macro/src/macroJsx.ts Lines 13 to 28 in e9fead0
If you want, backport it to js-lingui/packages/babel-plugin-transform-react/src/transformer.js Lines 377 to 380 in f212786
This will fix whitespace inconsistencies in JSX macros/plugins. JS macros/plugins use similar approach, so we might also want to fix that as well: Fix in js-lingui/packages/macro/src/macroJs.ts Lines 9 to 17 in e9fead0
Relevant code in
If you need any help with setting up the dev environment, please let me know 🙏 |
We bump into the same problem with TS.
We got
Any clues? lingui version: 3.13.3 |
@bukku-accounting could you please check if it's reproducible on the latest Lingui version? |
Reproducible in lingui 4.11.1 <Trans>
Friend will get
{' '}
{ticketsFromReferralSystem}
{' '}
extra tickets
</Trans> Produces |
Will be fixed in v5 Related PRs: #1882 Note in the changelog https://github.com/lingui/js-lingui/blob/e7b95a87496ba26db85cbae3b135650737f40fd0/website/docs/releases/migration-5.md#changes-in-whitespaces-handling |
Describe the bug
Any whitespace following a span wrapped by a lingui
<Trans>
tag is removed, contrary to React's own behavior.To Reproduce
In React, the following markup
produces "Welcome Jane to your website."
When wrapped with a lingui Trans tag, like so:
the output is "Welcome Janeto your website." -- the space after the span is removed.
Expected behavior
I expect a single space to remain after the node inside the Trans tag.
I've tried
ing my way out, trying multiple ways to mark up the strings, and so far I've been unable to get that wanted space to stop getting stripped out of my sentence, even with hacks!It's both inconsistent with React's behavior and a big pain in the butt when trying to translate any sentences with variables in them.
Additional context
The text was updated successfully, but these errors were encountered: