-
-
Notifications
You must be signed in to change notification settings - Fork 325
Open
Labels
Description
Is your feature request related to a problem? Please describe.
First results from icu-to-json
show, that messages can be compiled to an ultra-slim AST (or even just a plain string—in the case of plain strings) that has very little overhead in comparison to passing raw messages to the client side.
The benefits are:
- Faster message formatting at runtime
- No parsing on the client side
- Smaller bundle size
Describe the solution you'd like
Switch out intl-messageformat
for icu-to-json
and make sure the parser only runs on the server side (potentially cached) / at compile time.
Describe alternatives you've considered
Sticking with intl-messageformat
.
Also related:
- https://github.com/lingui/js-lingui/blob/main/packages/message-utils/src/compileMessage.ts#L94
- Pre-compile localized strings and remove intl-messageformat adobe/react-spectrum#3294. However, I think this pattern won't work well with RSC since functions can't be serialized.
belgattitude, eve0415, apavlinovic, francamps, stramel and 2 more