mirror of
https://github.com/vercel/commerce.git
synced 2025-05-14 05:37:51 +00:00
Merge pull request #12 from zenzen-sol/sol/preview-localization-fix
fix: attempt to reverse localization
This commit is contained in:
commit
4b690be940
@ -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({
|
||||
|
@ -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();
|
||||
|
@ -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 <CartModal cart={cart} promotedItem={promotedItem} />;
|
||||
|
@ -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('/') || '/';
|
||||
};
|
||||
|
||||
|
@ -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) =>
|
||||
|
@ -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 = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user