Files
lemonspace_app/app/layout.tsx
Matthias Meister 79d9092d43 Implement internationalization support across components
- Integrated `next-intl` for toast messages and locale handling in various components, including `Providers`, `CanvasUserMenu`, and `CreditOverview`.
- Replaced hardcoded strings with translation keys to enhance localization capabilities.
- Updated `RootLayout` to dynamically set the language attribute based on the user's locale.
- Ensured consistent user feedback through localized toast messages in actions such as sign-out, canvas operations, and billing notifications.
2026-04-01 18:16:52 +02:00

70 lines
2.1 KiB
TypeScript

import type { Metadata } from "next";
import { Manrope } from "next/font/google";
import * as Sentry from "@sentry/nextjs";
import "./globals.css";
import { cn } from "@/lib/utils";
import { Providers } from "@/components/providers";
import { InitUser } from "@/components/init-user";
import { getAuthUser, getToken } from "@/lib/auth-server";
import { getLocale, getMessages } from "next-intl/server";
const manrope = Manrope({ subsets: ["latin"], variable: "--font-sans" });
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const initialToken = await getToken();
const locale = await getLocale();
const messages = await getMessages();
const user = await getAuthUser();
if (user) {
const id = user.userId ?? String(user._id);
Sentry.setUser({
id,
email: user.email ?? undefined,
});
} else {
Sentry.setUser(null);
}
return (
<html
lang={locale}
suppressHydrationWarning
className={cn("h-full", "antialiased", "font-sans", manrope.variable)}
>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Lemonspace is a platform for creating and sharing digital content with nodes."
/>
<meta name="keywords" content="Lemonspace, digital content, platform" />
<meta name="author" content="Lemonspace" />
<meta name="robots" content="index, follow" />
<meta name="googlebot" content="index, follow" />
<meta name="bingbot" content="index, follow" />
<meta name="yandexbot" content="index, follow" />
<script
src="https://rybbit.matthias.lol/api/script.js"
data-site-id="bb1ac546eda7"
defer
></script>
</head>
<body className="min-h-full flex flex-col">
<Providers initialToken={initialToken} locale={locale} messages={messages}>
<InitUser />
{children}
</Providers>
</body>
</html>
);
}