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

Inconsistency between macro docs and typings/code #1433

Closed
thekip opened this issue Feb 13, 2023 · 1 comment
Closed

Inconsistency between macro docs and typings/code #1433

thekip opened this issue Feb 13, 2023 · 1 comment

Comments

@thekip
Copy link
Collaborator

thekip commented Feb 13, 2023

While working on #1340 found few more things:

  1. Docs states there should be a prop format https://lingui.dev/ref/macro#plural-1 in <Plural> and <SelectOrdinal> but there no such prop in macro typings. And also i don't see that prop in the Trans component. Need to validate this and or delete it from docs, or fix it in the code.
  2. There are also more props for than written in the docs.
     type TransProps = {
       id?: string
       comment?: string
       context?: string
       render?: (props: TransRenderProps) => ReactElement<any, any> | null
       i18n?: I18n
     }
    Need to check, do we really need all that props on the macro (render? ) and update code and docs.
@tricoder42
Copy link
Contributor

  1. The format prop allows you to customize formatting of number passed to plural/selectOrdinal. It's used here https://github.com/lingui/js-lingui/blob/main/packages/core/src/context.ts#L22. Trans component doesn't need it because it doesn't formats any values.
  2. Some props on macro were simply passed down to the actual function/component. I believe macro props were always subset of function/component props.

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

No branches or pull requests

3 participants