lingui / lingui/swc-plugin

Trans macro inside ConditionalExpressions are not processed

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
bug good first issue hacktoberfest
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.