diff --git a/src/app/core/store/core/configuration/configuration.selectors.spec.ts b/src/app/core/store/core/configuration/configuration.selectors.spec.ts index 1a1d554952..0de4d12cbd 100644 --- a/src/app/core/store/core/configuration/configuration.selectors.spec.ts +++ b/src/app/core/store/core/configuration/configuration.selectors.spec.ts @@ -19,6 +19,15 @@ import { getRestEndpoint, } from './configuration.selectors'; +// mock `isDevMode` to return `false` +jest.mock('@angular/core', () => { + const originalModule = jest.requireActual('@angular/core'); + return { + ...originalModule, + isDevMode: jest.fn(() => false), + }; +}); + describe('Configuration Selectors', () => { let store$: StoreWithSnapshots; diff --git a/src/app/core/store/core/configuration/configuration.selectors.ts b/src/app/core/store/core/configuration/configuration.selectors.ts index 3da4bb082f..6a1c85aad6 100644 --- a/src/app/core/store/core/configuration/configuration.selectors.ts +++ b/src/app/core/store/core/configuration/configuration.selectors.ts @@ -1,3 +1,4 @@ +import { isDevMode } from '@angular/core'; import { createSelector, createSelectorFactory, resultMemoize } from '@ngrx/store'; import { isEqual } from 'lodash-es'; @@ -59,10 +60,12 @@ export const getCurrentLocale = createSelector( internalDefaultLocale, getServerConfigParameter('general.defaultLocale'), (available, requested, defaultLocale, configuredDefault) => - available?.find(l => l === requested) ?? - available?.find(l => l === configuredDefault) ?? - available?.find(l => l === defaultLocale) ?? - available?.[0] + isDevMode() && defaultLocale + ? defaultLocale + : available?.find(l => l === requested) ?? + available?.find(l => l === configuredDefault) ?? + available?.find(l => l === defaultLocale) ?? + available?.[0] ); export const getAvailableCurrencies = createSelector( diff --git a/src/environments/environment.model.ts b/src/environments/environment.model.ts index 6381ae8bf0..f1c69c381b 100644 --- a/src/environments/environment.model.ts +++ b/src/environments/environment.model.ts @@ -85,7 +85,7 @@ export interface Environment { // default device type used for initial page responses defaultDeviceType: DeviceType; - // default locale that is used as fallback if no default locale from the ICM REST call is available + // default locale that is used as fallback if no default locale from the ICM REST call is available (should only be set for local development) defaultLocale?: string; // configuration filtering available locales and their active currencies @@ -146,7 +146,6 @@ export const ENVIRONMENT_DEFAULTS: Omit = { }, defaultProductListingViewType: 'grid', defaultDeviceType: 'mobile', - defaultLocale: 'en_US', multiSiteLocaleMap: { en_US: '/en', de_DE: '/de',