-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
☂️ Umbrella: List of potential features / changes for a major version #779
Comments
Adding the prefix for |
Return typed messages from Does anyone know a workaround for this? |
I find out how to properly type safe the We can overload the function in our import en from 'messages/en.json'
export type Messages = typeof en
declare module 'next-intl' {
interface IntlMessages extends Messages {}
function useMessages(): IntlMessages;
} |
After trying many things I ended using type assertion with const t = useTranslations()
const message = useMessages() as unknown as Messages Not ideal, but at least there's a workaround. |
All items mentioned above have been resolved in the next-intl 4.0 beta! |
The big goal for the next major release is to get everything out of the way that a) makes the setup harder than necessary and b) could slow down feature development for the foreseeable future.
This is a list of ideas for API changes that we could potentially introduce in a major version:
formats
to Client Components with an option to opt-out (formats={null}
). Keep in mind: fix: Don't retrieve defaults forlocale
,now
andtimeZone
if these options have been provided toNextIntlClientProvider
#633. See previously proposed docs changes in 80332fc.NextIntlClientProvider
inherit from each other? That would be very helpful to configure error handling as long as there's no better alternative (see Fully serializable config #611)next.config.js
might be the trickiest one, but Node.js 22 (scheduled to be recommended by Autumn '24) supportsrequire
ing ESM from CJS too. Alternatively we could consider making an exception fornext-intl/plugin
(ref). If we do this, we can likely also go far a faster size limit preset.@babel/preset-env
, as "safari 12" results in rest params being compiled. In exchange, we can reduce bundle size. Does Next.js apply code transforms for backwards compat anyway tonode_modules
? See also various options in next.config.js like bundlePagesRouterDependencies.['@babel/preset-react', {runtime: 'automatic'}]
"jsx": "react-jsx"
defaultTranslationValues
src/i18n.ts
createNavigation
#1316)const
type params increateMiddleware
, require TS >=5locale
return value ingetRequestConfig
resolvedOptions.localeDetection
from condition in middleware (mention in changelog), add section to docs about possibility of using a longer max-age value (but you need to tell users next to your language picker)useMessages()
hook usingIntlMessages
#1452useLocale
#1377? (in case we overhaul the type registration API) Check this in combination with other types that receive alocale
(e.g. routing APIs).RequestLocaleLegacy
(only an internal change)(remaining tasks have been moved to #1412)
No decision has been made on these so far, but if you have feedback about these points, please leave it here!
The text was updated successfully, but these errors were encountered: