@shopify/cli
Version:
A CLI tool to build for the Shopify platform
17 lines (13 loc) • 525 B
text/typescript
import type {LoaderFunctionArgs} from '@shopify/remix-oxygen';
export async function loader({params, context}: LoaderFunctionArgs) {
const {language, country} = context.storefront.i18n;
if (
params.locale &&
params.locale.toLowerCase() !== `${language}-${country}`.toLowerCase()
) {
// If the locale URL param is defined, yet we still are still at the default locale
// then the the locale param must be invalid, send to the 404 page
throw new Response(null, {status: 404});
}
return null;
}