diff --git a/messages/ro.json b/messages/ro.json deleted file mode 100644 index 1580089..0000000 --- a/messages/ro.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "navigation": { - "nav-getting-started": "Noțiuni de bază", - "donate": "Donează", - "useful-links": "Linkuri utile" - } -} diff --git a/next.config.js b/next.config.js index f359c52..f8b2a17 100644 --- a/next.config.js +++ b/next.config.js @@ -1,8 +1,6 @@ const createNextIntlPlugin = require('next-intl/plugin'); const { PHASE_DEVELOPMENT_SERVER } = require('next/constants') - -const withNextIntl = createNextIntlPlugin(); /** @type {import('next').NextConfig} */ const nextConfig = (phase, { defaultConfig }) => { @@ -20,7 +18,6 @@ const nextConfig = (phase, { defaultConfig }) => { pathname: '/gh/zen-browser/**', } ], - formats: ["image/png", "image/jpeg", "image/svg+xml", "image/webp"], domains: ['localhost', 'cdn.jsdelivr.net', "raw.githubusercontent.com"], // Allow images from jsDelivr }, experimental: { @@ -32,6 +29,18 @@ const nextConfig = (phase, { defaultConfig }) => { compiler: { styledComponents: true, }, + webpack: ( + config, + { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack } + ) => { + // Important: return the modified config + return { + output: { + // ... + globalObject: 'this', + }, + } + }, }; if (phase === PHASE_DEVELOPMENT_SERVER) { return { @@ -46,4 +55,4 @@ const nextConfig = (phase, { defaultConfig }) => { }; }; -module.exports = withNextIntl(nextConfig); +module.exports = nextConfig; diff --git a/src/app/branding-assets/page.tsx b/src/app/[locale]/branding-assets/page.tsx similarity index 82% rename from src/app/branding-assets/page.tsx rename to src/app/[locale]/branding-assets/page.tsx index 2399c78..da7063b 100644 --- a/src/app/branding-assets/page.tsx +++ b/src/app/[locale]/branding-assets/page.tsx @@ -6,8 +6,6 @@ export default function BrandingAssetsPage() { return (
-
); } diff --git a/src/app/create-theme/page.tsx b/src/app/[locale]/create-theme/page.tsx similarity index 81% rename from src/app/create-theme/page.tsx rename to src/app/[locale]/create-theme/page.tsx index 867610e..ee3cf84 100644 --- a/src/app/create-theme/page.tsx +++ b/src/app/[locale]/create-theme/page.tsx @@ -6,8 +6,6 @@ export default function BrandingAssetsPage() { return (
-
); } diff --git a/src/app/download/page.tsx b/src/app/[locale]/download/page.tsx similarity index 81% rename from src/app/download/page.tsx rename to src/app/[locale]/download/page.tsx index ce92777..fc586ec 100644 --- a/src/app/download/page.tsx +++ b/src/app/[locale]/download/page.tsx @@ -7,8 +7,6 @@ export default function Download() { return (
-
); } diff --git a/src/app/feed.xml/route.ts b/src/app/[locale]/feed.xml/route.ts similarity index 100% rename from src/app/feed.xml/route.ts rename to src/app/[locale]/feed.xml/route.ts diff --git a/src/app/globals.css b/src/app/[locale]/globals.css similarity index 100% rename from src/app/globals.css rename to src/app/[locale]/globals.css diff --git a/src/app/layout.tsx b/src/app/[locale]/layout.tsx similarity index 57% rename from src/app/layout.tsx rename to src/app/[locale]/layout.tsx index e48f367..3cf405b 100644 --- a/src/app/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -4,7 +4,10 @@ import "./globals.css"; import { ThemeProvider } from "@/components/theme-provider"; import StyledComponentsRegistry from "@/lib/styled-components-registry"; import {NextIntlClientProvider} from 'next-intl'; -import {getLocale, getMessages} from 'next-intl/server'; +import {unstable_setRequestLocale} from 'next-intl/server'; +import Footer from "@/components/footer"; +import { Navigation } from "@/components/navigation"; +import { notFound } from "next/navigation"; const inter = Inter({ subsets: ["latin"] }); @@ -16,14 +19,29 @@ export const metadata: Metadata = { keywords: ["Zen", "Browser", "Zen Browser", "Web", "Internet", "Fast"], }; +const SUPPORTED_LANGUAGES = ["en", "de"]; + +async function getMessages(locale: string) { + try { + return (await import(`../../../messages/${locale}.json`)).default + } catch (error) { + notFound() + } +} + +export function generateStaticParams() { + return SUPPORTED_LANGUAGES.map((locale) => ({locale})); +} + export default async function RootLayout({ children, + params: {locale}, }: Readonly<{ children: React.ReactNode; + params: {locale: string}; }>) { - const locale = await getLocale(); - - const messages = await getMessages(); + unstable_setRequestLocale(locale); + const messages = await getMessages(locale); return ( @@ -32,14 +50,20 @@ export default async function RootLayout({ - + - {children} + +
+ {children} +
+ {/* At the bottom of the page */} +
+
diff --git a/src/app/not-found.tsx b/src/app/[locale]/not-found.tsx similarity index 82% rename from src/app/not-found.tsx rename to src/app/[locale]/not-found.tsx index f9e9338..d05717c 100644 --- a/src/app/not-found.tsx +++ b/src/app/[locale]/not-found.tsx @@ -8,8 +8,6 @@ export default function NotFoundPage() { return (

404

-
- {/* At the bottom of the page */}
); } diff --git a/src/app/page.tsx b/src/app/[locale]/page.tsx similarity index 84% rename from src/app/page.tsx rename to src/app/[locale]/page.tsx index d3867cd..c70c0f1 100644 --- a/src/app/page.tsx +++ b/src/app/[locale]/page.tsx @@ -10,8 +10,6 @@ export default function Home() {
-
- {/* At the bottom of the page */}
); } diff --git a/src/app/privacy-policy/markdown.css b/src/app/[locale]/privacy-policy/markdown.css similarity index 100% rename from src/app/privacy-policy/markdown.css rename to src/app/[locale]/privacy-policy/markdown.css diff --git a/src/app/privacy-policy/page.tsx b/src/app/[locale]/privacy-policy/page.tsx similarity index 98% rename from src/app/privacy-policy/page.tsx rename to src/app/[locale]/privacy-policy/page.tsx index a3ee48f..a178837 100644 --- a/src/app/privacy-policy/page.tsx +++ b/src/app/[locale]/privacy-policy/page.tsx @@ -91,8 +91,6 @@ If you have any questions or concerns about this Privacy Policy or Zen Browser, By using Zen Browser, you agree to this Privacy Policy. Remember, with Zen, your privacy is in your hands.`} -