From 9d843849888e79e96e0382e34b5829d694d9285c Mon Sep 17 00:00:00 2001 From: Jorge Moya Date: Thu, 12 Sep 2024 12:49:57 -0500 Subject: [PATCH] fix(core): change locale prefix to to prevent caching issues --- .changeset/gentle-eyes-double.md | 8 ++++++++ core/i18n/routing.ts | 8 ++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 .changeset/gentle-eyes-double.md diff --git a/.changeset/gentle-eyes-double.md b/.changeset/gentle-eyes-double.md new file mode 100644 index 000000000..5e4cdac20 --- /dev/null +++ b/.changeset/gentle-eyes-double.md @@ -0,0 +1,8 @@ +--- +"@bigcommerce/catalyst-core": patch +--- + +Change LocalePrefix mode to `as-needed`, since there's an issue that is causing caching problems when using `never`. + +More info about LocalePrefixes: https://next-intl-docs.vercel.app/docs/routing#shared-configuration +Open issue: https://github.com/amannn/next-intl/issues/786 diff --git a/core/i18n/routing.ts b/core/i18n/routing.ts index d9594d61a..c38de3e3e 100644 --- a/core/i18n/routing.ts +++ b/core/i18n/routing.ts @@ -64,13 +64,13 @@ export const localeLanguageRegionMap: LocaleEntry[] = [ enum LocalePrefixes { ALWAYS = 'always', - NEVER = 'never', + // Don't use NEVER as there is a issue that causes cache problems and returns the wrong messages. + // More info: https://github.com/amannn/next-intl/issues/786 + // NEVER = 'never', ASNEEDED = 'as-needed', // removes prefix on default locale } -// Temporary we use NEVER prefix to prioritize accept-language header -// & disable internationalized routes due to incomplete multilingual implementation -export const localePrefix: LocalePrefix = LocalePrefixes.NEVER; +export const localePrefix: LocalePrefix = LocalePrefixes.ASNEEDED; export const defaultLocale = 'en';