-
-
Couldn't load subscription status.
- Fork 1k
feat: add IcuTrans component for eventual use in icu.macro #1871
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
Conversation
|
Do you want me to merge this right now or should we wait? |
This is mergeable as-is (if people really want to, they can use this without icu.macro) That specific document isn't yet updateable, but I could see adding a new sibling doc to Trans. I wonder if we should leave it undocumented for now, until the icu macro PR is reviewed? Just so we don't lock in things that need changing immediately |
Yes, let's wait for the docs... will merge, but not yet create a new release, ok? |
| import React from 'react'; | ||
| import { warn, warnOnce, isString } from './utils.js'; | ||
| import { getI18n } from './i18nInstance.js'; | ||
| import { renderTranslation } from './IcuTransUtils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you try with v16.1.2 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, waiting for build, btw the import seems to work with ./IcuTransUtils/renderTranslation.js :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrai ya that version is clean and tests good on our stuff, thanks for the quick fix :)
Issue #1869
This adds a new
Transcomponent that does not useReact.Childrenunder the hood, but instead usesReact.createElementand expects a tree of components (contents) that instead passes in the components to render. This eliminates a whole slew of weird hard-to-diagnose bugs, and most importantly, makesTranscompatible with the new React compiler that was just released as version 1.0 last week.A follow-up PR will adjust the icu macro to use this new component under the hood. It's designed to be a drop-in replacement for the code that is compiled, but requires a different parsing logic in the babel macro.
Checklist
npm run testChecklist (for documentation change)