Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
51 changes: 51 additions & 0 deletions apps/timo-web/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import "./globals.css";
import localFont from "next/font/local";
import { notFound } from "next/navigation";
import { hasLocale, NextIntlClientProvider } from "next-intl";

import type { Metadata } from "next";

import { routing } from "@/i18n/routing";
import { QueryProvider } from "@/providers/QueryProvider";

const pretendard = localFont({
src: "./fonts/PretendardVariable.woff2",
variable: "--font-family-pretendard",
weight: "45 920",
display: "swap",
});

export const metadata: Metadata = {
title: "Timo",
description: "Timo web",
};

interface RootLayoutProps {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}

export function generateStaticParams() {
return routing.locales.map((locale) => ({ locale }));
}

export default async function RootLayout({
children,
params,
}: Readonly<RootLayoutProps>) {
const { locale } = await params;

if (!hasLocale(routing.locales, locale)) {
notFound();
}

return (
<html lang={locale} className={pretendard.variable}>
<body>
<NextIntlClientProvider>
<QueryProvider>{children}</QueryProvider>
</NextIntlClientProvider>
</body>
</html>
);
}
7 changes: 7 additions & 0 deletions apps/timo-web/app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { useTranslations } from "next-intl";

export default function Home() {
const t = useTranslations("HomePage");

return <>{t("title")}</>;
}
Comment thread
kimminna marked this conversation as resolved.
Resolved
32 changes: 0 additions & 32 deletions apps/timo-web/app/layout.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions apps/timo-web/app/page.tsx

This file was deleted.

6 changes: 6 additions & 0 deletions apps/timo-web/i18n/navigation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createNavigation } from "next-intl/navigation";

import { routing } from "./routing";

export const { Link, redirect, usePathname, useRouter, getPathname } =
createNavigation(routing);
16 changes: 16 additions & 0 deletions apps/timo-web/i18n/request.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { hasLocale } from "next-intl";
import { getRequestConfig } from "next-intl/server";

import { routing } from "./routing";

export default getRequestConfig(async ({ requestLocale }) => {
const requested = await requestLocale;
const locale = hasLocale(routing.locales, requested)
? requested
: routing.defaultLocale;

return {
locale,
messages: (await import(`../messages/${locale}.json`)).default,
};
});
7 changes: 7 additions & 0 deletions apps/timo-web/i18n/routing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineRouting } from "next-intl/routing";

export const routing = defineRouting({
locales: ["en", "ko"],
defaultLocale: "en",
localePrefix: "as-needed",
});
5 changes: 5 additions & 0 deletions apps/timo-web/messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"HomePage": {
"title": "Hi Timo"
}
}
5 changes: 5 additions & 0 deletions apps/timo-web/messages/ko.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"HomePage": {
"title": "안녕 티모"
}
}
5 changes: 4 additions & 1 deletion apps/timo-web/next.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/* global process */
import { withSentryConfig } from "@sentry/nextjs";
import createNextIntlPlugin from "next-intl/plugin";

/** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ["@repo/timo-design-system"],
};

export default withSentryConfig(nextConfig, {
const withNextIntl = createNextIntlPlugin();

export default withSentryConfig(withNextIntl(nextConfig), {
org: "timo-client",
project: "timo-web",
authToken: process.env["SENTRY_AUTH_TOKEN"],
Expand Down
1 change: 1 addition & 0 deletions apps/timo-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@tanstack/react-query-devtools": "^5.101.1",
"axios": "^1.18.1",
"next": "16.2.0",
"next-intl": "^4.13.1",
Comment thread
kimminna marked this conversation as resolved.
Resolved
"react": "^19.2.0",
"react-dom": "^19.2.0",
"zod": "^4.4.3"
Expand Down
9 changes: 9 additions & 0 deletions apps/timo-web/proxy.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

미들웨어 파일명이 proxy.ts인데, Next.js는 미들웨어를 middleware.ts로만 인식하는 걸로 알고 있어요. proxy.ts로는 실제로 미들웨어가 동작하지 않을 것 같아서요 middleware.ts로 rename이 필요하지 않을까요?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

middleware -> proxy로 변경이 되었다고 알고 있습니다!

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import createMiddleware from "next-intl/middleware";

import { routing } from "./i18n/routing";

export default createMiddleware(routing);

export const config = {
matcher: ["/((?!api|_next|.*\\..*).*)"],
};
Loading
Loading