Trans macro inside ConditionalExpressions are not processed
- Dominant language
- Rust
- Stars
- 78
- Forks
- 33
- Avg merge
- 7h 23m
- Merged PRs (30d)
- 4
Description
Related PR in upstream repo: https://github.com/lingui/js-lingui/pull/1436
**To Reproduce**
```ts
import { Trans } from '@lingui/macro'
export default function Component(props) {
return Hello, {props.world ? world : guys}
}
```
**Expected behaviour**
```ts
import { Trans } from '@lingui/react'
export default function Component(props) {
return (
:
}}
/>
)
}
```
**Actual behaviour**
```ts
import { Trans } from '@lingui/react'
export default function Component(props) {
return (
world : guys
}}
/>
)
}
```
Contributor guide
Research direction
Start with the related upstream pull request at https://github.com/lingui/js-lingui/pull/1436 and reproduce the shown TypeScript example through the SWC plugin. Trace how nested Trans macros inside a conditional expression are processed; done means both branches become self-closing Trans elements with ids of "world" and "guys" as shown in the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, typescript
- Domain
- internationalization, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100