diff --git a/examples/nextjs-swc/next.config.ts b/examples/nextjs-swc/next.config.ts index 2628cc2e6..248ffdffa 100644 --- a/examples/nextjs-swc/next.config.ts +++ b/examples/nextjs-swc/next.config.ts @@ -3,15 +3,16 @@ import type { NextConfig } from 'next' const nextConfig: NextConfig = { experimental: { swcPlugins: [['@lingui/swc-plugin', {}]], - turbo: { - rules: { - '*.po': { - loaders: ['@lingui/loader'], - as: '*.js' - } - } - } - } + }, + webpack: (config) => { + config.module.rules.push({ + test: /\.po$/, + use: { + loader: '@lingui/loader', + }, + }) + return config + }, } export default nextConfig diff --git a/examples/nextjs-swc/package.json b/examples/nextjs-swc/package.json index c09288644..5e70662ef 100644 --- a/examples/nextjs-swc/package.json +++ b/examples/nextjs-swc/package.json @@ -13,6 +13,7 @@ }, "dependencies": { "@lingui/core": "^5.1.2", + "@lingui/macro": "^5.1.2", "@lingui/react": "^5.1.2", "negotiator": "^0.6.3", "next": "15.0.1", diff --git a/examples/nextjs-swc/src/app/[lang]/app-router-demo/page.tsx b/examples/nextjs-swc/src/app/[lang]/app-router-demo/page.tsx index 03ee59221..ff4578f35 100644 --- a/examples/nextjs-swc/src/app/[lang]/app-router-demo/page.tsx +++ b/examples/nextjs-swc/src/app/[lang]/app-router-demo/page.tsx @@ -1,7 +1,7 @@ import { HomePage } from '../../../components/HomePage' import { initLingui } from '../../../initLingui' -export default async function Page(props) { +export default async function Page(props: any) { const lang = (await props.params).lang initLingui(lang) return diff --git a/examples/nextjs-swc/src/app/[lang]/layout.tsx b/examples/nextjs-swc/src/app/[lang]/layout.tsx index f9e678582..fd2dccb6c 100644 --- a/examples/nextjs-swc/src/app/[lang]/layout.tsx +++ b/examples/nextjs-swc/src/app/[lang]/layout.tsx @@ -4,7 +4,6 @@ import { LinguiClientProvider } from '../../components/LinguiClientProvider' import { initLingui, PageLangParam } from '../../initLingui' import React from 'react' import { t } from '@lingui/macro' -import { setI18n } from '@lingui/react/server' export async function generateStaticParams() { return linguiConfig.locales.map((lang) => ({ lang })) @@ -18,7 +17,7 @@ export async function generateMetadata(props: PageLangParam) { } } -export default async function RootLayout({ children, params }) { +export default async function RootLayout({ children, params }: any) { const lang = (await params).lang initLingui(lang) diff --git a/examples/nextjs-swc/src/app/[lang]/page.tsx b/examples/nextjs-swc/src/app/[lang]/page.tsx index 9498097d8..d3f9972df 100644 --- a/examples/nextjs-swc/src/app/[lang]/page.tsx +++ b/examples/nextjs-swc/src/app/[lang]/page.tsx @@ -1,9 +1,11 @@ +import Link from "next/link" + export default function Index() { return ( <> This is the homepage of the demo app. This page is not localized. You can - go to the App router demo or the{' '} - Pages router demo. + go to the App router demo or the{' '} + Pages router demo. ) } diff --git a/examples/nextjs-swc/src/locales/en.po b/examples/nextjs-swc/src/locales/en.po index 0c5f27f36..a49fa9b24 100644 --- a/examples/nextjs-swc/src/locales/en.po +++ b/examples/nextjs-swc/src/locales/en.po @@ -38,8 +38,8 @@ msgstr "Serbian" msgid "Spanish" msgstr "Spanish" -#: src/app/[lang]/layout.tsx:16 #: src/components/HomePage.tsx:21 +#: src/app/[lang]/layout.tsx:16 msgid "Translation Demo" msgstr "Translation Demo" diff --git a/examples/nextjs-swc/src/locales/es.po b/examples/nextjs-swc/src/locales/es.po index 7089e0fdd..05846de70 100644 --- a/examples/nextjs-swc/src/locales/es.po +++ b/examples/nextjs-swc/src/locales/es.po @@ -38,8 +38,8 @@ msgstr "Serbio" msgid "Spanish" msgstr "Español" -#: src/app/[lang]/layout.tsx:16 #: src/components/HomePage.tsx:21 +#: src/app/[lang]/layout.tsx:16 msgid "Translation Demo" msgstr "Demostración de Traducción" diff --git a/examples/nextjs-swc/src/locales/pseudo.po b/examples/nextjs-swc/src/locales/pseudo.po index a907b95ba..780230f0d 100644 --- a/examples/nextjs-swc/src/locales/pseudo.po +++ b/examples/nextjs-swc/src/locales/pseudo.po @@ -38,8 +38,8 @@ msgstr "" msgid "Spanish" msgstr "" -#: src/app/[lang]/layout.tsx:16 #: src/components/HomePage.tsx:21 +#: src/app/[lang]/layout.tsx:16 msgid "Translation Demo" msgstr "" diff --git a/examples/nextjs-swc/src/locales/sr.po b/examples/nextjs-swc/src/locales/sr.po index 9db9c88fc..4b5494169 100644 --- a/examples/nextjs-swc/src/locales/sr.po +++ b/examples/nextjs-swc/src/locales/sr.po @@ -38,8 +38,8 @@ msgstr "Српски" msgid "Spanish" msgstr "Шпански" -#: src/app/[lang]/layout.tsx:16 #: src/components/HomePage.tsx:21 +#: src/app/[lang]/layout.tsx:16 msgid "Translation Demo" msgstr "Демо Превод" diff --git a/examples/nextjs-swc/yarn.lock b/examples/nextjs-swc/yarn.lock index 4e15d4b93..441974696 100644 --- a/examples/nextjs-swc/yarn.lock +++ b/examples/nextjs-swc/yarn.lock @@ -1180,6 +1180,24 @@ __metadata: languageName: node linkType: hard +"@lingui/macro@npm:^5.1.2": + version: 5.1.2 + resolution: "@lingui/macro@npm:5.1.2" + dependencies: + "@lingui/core": ^5.1.2 + "@lingui/react": ^5.1.2 + peerDependencies: + "@lingui/babel-plugin-lingui-macro": 5.1.2 + babel-plugin-macros: 2 || 3 + peerDependenciesMeta: + "@lingui/babel-plugin-lingui-macro": + optional: true + babel-plugin-macros: + optional: true + checksum: 5161f4cfb4113c75020ce4a8e4a1ecef0c5f2aa5c1214c00861d0c7d2f6bbdcb36ed992137167b81229dfb45de571ad507de5b42aabdb030b79271132d819786 + languageName: node + linkType: hard + "@lingui/message-utils@npm:^5.1.2": version: 5.1.2 resolution: "@lingui/message-utils@npm:5.1.2" @@ -4986,6 +5004,7 @@ __metadata: "@lingui/cli": ^5.1.2 "@lingui/core": ^5.1.2 "@lingui/loader": ^5.1.2 + "@lingui/macro": ^5.1.2 "@lingui/react": ^5.1.2 "@lingui/swc-plugin": ^5.0.1 "@types/negotiator": ^0.6.3