app/error.tsx | 9 ++-- app/layout.tsx | 5 ++ app/product/[handle]/page.tsx | 4 +- app/search/layout.tsx | 4 +- components/cart/add-to-cart.tsx | 8 ++-- components/cart/delete-item-button.tsx | 4 +- components/cart/modal.tsx | 8 ++-- components/layout/footer.tsx | 10 ++-- components/layout/navbar/mobile-menu.tsx | 6 ++- components/layout/navbar/search.tsx | 7 ++- components/layout/search/collections.tsx | 4 +- i18n/request.ts | 11 +++++ messages/en.json | 42 ++++++++++++++++ messages/ja.json | 42 ++++++++++++++++ messages/translation-todo.json | 82 ++++++++++++++++++++++++++++++++ next.config.ts | 7 ++- package.json | 3 +- pnpm-workspace.yaml | 2 + 18 files changed, 233 insertions(+), 25 deletions(-) diff --git a/app/error.tsx b/app/error.tsx index 817ef75..b2b9d09 100644 --- a/app/error.tsx +++ b/app/error.tsx @@ -1,18 +1,19 @@ "use client"; +import { useTranslations } from 'next-intl'; export default function Error({ reset }: { reset: () => void }) { + const t = useTranslations(); return (
-

Oh no!

+

{t('error.oh_no')}

- There was an issue with our storefront. This could be a temporary issue, - please try your action again. + {t('error.there_was_an_issue_with_our_storefront_t')}

); diff --git a/app/layout.tsx b/app/layout.tsx index 4e4b4af..cba49f0 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,3 +1,5 @@ +import { NextIntlClientProvider } from 'next-intl'; +import { getMessages } from 'next-intl/server'; import { CartProvider } from "components/cart/cart-context"; import { Navbar } from "components/layout/navbar"; import { WelcomeToast } from "components/welcome-toast"; @@ -27,12 +29,14 @@ export default async function RootLayout({ }: { children: ReactNode; }) { + const messages = await getMessages(); // Don't await the fetch, pass the Promise to the context provider const cart = getCart(); return ( +
@@ -41,6 +45,7 @@ export default async function RootLayout({
+
); diff --git a/app/product/[handle]/page.tsx b/app/product/[handle]/page.tsx index 715178d..58ceb2e 100644 --- a/app/product/[handle]/page.tsx +++ b/app/product/[handle]/page.tsx @@ -1,3 +1,4 @@ +import { getTranslations } from 'next-intl/server'; import { GridTileImage } from "components/grid/tile"; import Footer from "components/layout/footer"; import { Gallery } from "components/product/gallery"; @@ -111,13 +112,14 @@ export default async function ProductPage(props: { } async function RelatedProducts({ id }: { id: string }) { + const t = await getTranslations(); const relatedProducts = await getProductRecommendations(id); if (!relatedProducts.length) return null; return (
-

Related Products

+

{t('page.related_products')}