Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): change locale prefix to to prevent caching issues #1360

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/gentle-eyes-double.md
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions core/i18n/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Loading