QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.19k stars 52 forks source link

perf(next-international) improve caching and calls #337

Open Yovach opened 5 months ago

Yovach commented 5 months ago

The following code can become heavy with multiple keys and usage of scopes: https://github.com/QuiiBz/next-international/blob/7887342c60f5cceaa8ed0456a8ef068db4b87909/packages/next-international/src/common/create-t.ts#L26-L30 I think we can store all the plural keys after the first iteration so that we don't need to iterate over the keys anymore

On the following code : https://github.com/QuiiBz/next-international/blob/7887342c60f5cceaa8ed0456a8ef068db4b87909/packages/next-international/src/app/client/create-i18n-provider-client.tsx#L27-L31

The Map.prototype.set is returning the Map so we don't to check if the localesCache has locale as a key because we already have this information with the localesCache.get

vercel[bot] commented 5 months ago

@Yovach is attempting to deploy a commit to the Tom Labs Team on Vercel.

A member of the Team first needs to authorize it.