Merge pull request #10 from zenzen-sol/sol/preview-localization-fix

fix: Reverse preview localization issues
This commit is contained in:
Sol Irvine 2023-10-08 15:37:14 +09:00 committed by GitHub
commit 8a60e55d73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ export default async function Cart({ locale }: { locale?: SupportedLocale }) {
const promotedItem: Product | undefined = await getProduct({ const promotedItem: Product | undefined = await getProduct({
handle: 'gift-bag-and-postcard-set', handle: 'gift-bag-and-postcard-set',
language: locale?.toUpperCase() || 'JA' language: locale?.toUpperCase() || 'EN'
}); });
return <CartModal cart={cart} promotedItem={promotedItem} />; return <CartModal cart={cart} promotedItem={promotedItem} />;

View File

@ -19,7 +19,7 @@ export const LanguageControl = ({ lang }: { lang?: SupportedLocale }) => {
const basePathName = () => { const basePathName = () => {
const unjoined = pathName.split('/'); const unjoined = pathName.split('/');
const unjoinedWithoutLocale = removeItem(unjoined, 'en'); const unjoinedWithoutLocale = removeItem(unjoined, 'ja');
return unjoinedWithoutLocale.join('/') || '/'; return unjoinedWithoutLocale.join('/') || '/';
}; };

View File

@ -2,10 +2,10 @@ import createMiddleware from 'next-intl/middleware';
export default createMiddleware({ export default createMiddleware({
// A list of all locales that are supported // A list of all locales that are supported
locales: ['ja', 'en'], locales: ['en', 'ja'],
// If this locale is matched, pathnames work without a prefix (e.g. `/about`) // If this locale is matched, pathnames work without a prefix (e.g. `/about`)
defaultLocale: 'ja' defaultLocale: 'en'
}); });
export const config = { export const config = {