Closed roux1max closed 1 year ago
Thanks, I've just released 0.9.2 which fixes the type bug. You could already pass a config parameter but the type was wrong.
Awesome! Thanks!
In the same spirit, getStaticParams
does not take a config param to change the segment name which means that if you use a segment name that is different than "locale", it won't work.
getStaticParams
doesn't need the segment name, as it uses directly the keys of the locales object from createI18nServer
:
It does, the key returned by each object in the array is 'locale'
, which will match the path segment as per NextJs documentation.
In order for createGetStaticParams
to work, it would need to be changed to something like this:
export function createGetStaticParams<Locales extends ImportedLocales>(locales: Locales) {
return function getStaticParams(config?: I18nCurrentLocaleConfig) {
return Object.keys(locales).map(locale => ({
[config?.segmentName ?? DEFAULT_SEGMENT_NAME]: locale,
}));
};
}
Oh I understand what you mean now, sorry. I'll make another fix for it.
Hi!
Thanks for the work here. I was just looking at the code and noticed that the
createUseCurrentLocale()
function insrc/app/client
has a return type that does not match the returned function (theconfig
parameter is missing). Is it intentional?If it is, how can we provide a custom segment name?