Replies: 2 comments 3 replies
-
|
Here is my version that works - file import { getI18nInstance } from "@/appRouterI18n";
import { msg } from "@lingui/core/macro";
export function GET() {
const locale = 'de' // Will be reworked to get from the URL like `?lang=de`.
const i18n = getI18nInstance(locale)
const output = i18n._(msg`Homepage`)
return new Response(output)
}It works, but this part |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
You can use |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I need to return a translated string on a Next.js API call response, but I can't find the correct way to do this in the documentation, so could anybody please share an example of how to do this right?
Here is an example of the ideal solution - file
src/app/api/test2/route.ts:But it doesn't work. So, could anyone please share a working code for this using the recommended approach?
Beta Was this translation helpful? Give feedback.
All reactions