Replies: 2 comments
-
@JoyCood please follow issue template with actual behaviour and expected behaviour function m() {
return {
title: t`home`,
description: t`home desc`
}
}
export const metadata: Metadata = m(); From what i see, you assigning result of Instead, you should use dynamic metadata with import {setupI18n, I18n} from "@lingui/core"
async function getI18n(local: string): I18n {
// assume you already implemented a way to load your message catalog
const messages = await loadMessages();
return setupI18n({locale, messages})
}
export function generateMetadata(
{ params, searchParams }: Props,
parent?: ResolvingMetadata
): Metadata {
// You could not use global i18n / t in server context as your server could process multiple requestsat the same time and you will receive wrong / not actual results. So create i18n instance for each request.
const i18n = getI18n(params['lang']);
return {
title: t(i18n)`home`,
description: t(i18n)`home desc`
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
we have get the local on pathName only? no other way like Redux? will you please provide an example how to achieve international example with Redux, i can't find any tips or code in websise or google. thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
app/layout.tsx
package.json
Beta Was this translation helpful? Give feedback.
All reactions