Skip to content

Commit

Permalink
fix(types): <Trans>can have an i18n props (#1308)
Browse files Browse the repository at this point in the history
Sometimes you need to force the `i18n` instance used by `<Trans>`. In my case, it is to have a server-side render of a React PDF document, where I do not have a global `i18n` instance but several global ones (one per language).

The macro seems to properly handle this, and this patch works fine locally with our app.

For example:

```
component Test = () => {
    const i = useLingui()

  return <Text><Trans i18n={i.i18n}>Test String</Trans></Text>
}
```
  • Loading branch information
renchap authored Dec 8, 2022
1 parent 87e6f1f commit de01f8d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/macro/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export type TransProps = {
children?: React.ReactNode
component?: React.ComponentType<TransRenderProps>
render?: (props: TransRenderProps) => ReactElement<any, any> | null
i18n?: I18n
}

export type ChoiceProps = {
Expand Down

0 comments on commit de01f8d

Please sign in to comment.