From bc3db70bd9b01d925967f8d83f526e31305bd8ce Mon Sep 17 00:00:00 2001 From: Sol Irvine Date: Sun, 8 Oct 2023 21:36:08 +0900 Subject: [PATCH 1/2] revert for japan-first settings --- components/cart/index.tsx | 2 +- components/layout/navbar/language-control.tsx | 2 +- middleware.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/cart/index.tsx b/components/cart/index.tsx index f82c7a67f..d5e9103ef 100644 --- a/components/cart/index.tsx +++ b/components/cart/index.tsx @@ -14,7 +14,7 @@ export default async function Cart({ locale }: { locale?: SupportedLocale }) { const promotedItem: Product | undefined = await getProduct({ handle: 'gift-bag-and-postcard-set', - language: locale?.toUpperCase() || 'EN' + language: locale?.toUpperCase() || 'JA' }); return ; diff --git a/components/layout/navbar/language-control.tsx b/components/layout/navbar/language-control.tsx index 13457f763..993fbf32a 100644 --- a/components/layout/navbar/language-control.tsx +++ b/components/layout/navbar/language-control.tsx @@ -19,7 +19,7 @@ export const LanguageControl = ({ lang }: { lang?: SupportedLocale }) => { const basePathName = () => { const unjoined = pathName.split('/'); - const unjoinedWithoutLocale = removeItem(unjoined, 'ja'); + const unjoinedWithoutLocale = removeItem(unjoined, 'en'); return unjoinedWithoutLocale.join('/') || '/'; }; diff --git a/middleware.ts b/middleware.ts index b0a3d6402..f7520bddd 100644 --- a/middleware.ts +++ b/middleware.ts @@ -2,10 +2,10 @@ import createMiddleware from 'next-intl/middleware'; export default createMiddleware({ // A list of all locales that are supported - locales: ['en', 'ja'], + locales: ['ja', 'en'], // If this locale is matched, pathnames work without a prefix (e.g. `/about`) - defaultLocale: 'en' + defaultLocale: 'ja' }); export const config = { From 154bda33fe604d88813b11c50a1486c9b03bda24 Mon Sep 17 00:00:00 2001 From: Sol Irvine Date: Mon, 9 Oct 2023 07:34:59 +0900 Subject: [PATCH 2/2] more locale updates --- app/[locale]/layout.tsx | 2 +- app/[locale]/opengraph-image.tsx | 1 + messages/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index 13e6a7067..43ccc6d15 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -71,7 +71,7 @@ const noto = Noto_Serif_JP({ }); export function generateStaticParams() { - return [{ locale: 'en' }, { locale: 'ja' }]; + return [{ locale: 'ja' }, { locale: 'en' }]; } export default async function RootLayout({ diff --git a/app/[locale]/opengraph-image.tsx b/app/[locale]/opengraph-image.tsx index 23762cbdd..434a936b8 100644 --- a/app/[locale]/opengraph-image.tsx +++ b/app/[locale]/opengraph-image.tsx @@ -1,6 +1,7 @@ import OpengraphImage from 'components/opengraph-image'; export const runtime = 'edge'; +export const revalidate = 300; // 5 minutes in seconds export default async function Image() { return await OpengraphImage(); diff --git a/messages/index.ts b/messages/index.ts index c30991df6..b3954444f 100644 --- a/messages/index.ts +++ b/messages/index.ts @@ -4,8 +4,8 @@ import 'server-only'; // We enumerate all dictionaries here for better linting and typescript support // We also get the default import for cleaner types const dictionaries = { - en: () => import('./en.json').then((module) => module.default), - ja: () => import('./ja.json').then((module) => module.default) + ja: () => import('./ja.json').then((module) => module.default), + en: () => import('./en.json').then((module) => module.default) }; export const getDictionary = async (locale: SupportedLocale) =>