Files
klz-cables.com/.pnpm-store/v10/files/06/de0d56097ba81025a9c694202173d3e78394b3ec8d6e31b78a0c35ea687fd0881ecd49fb91e9b3c92fc9430c2979cc3b4d245c4393d150d93465041b799797
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

20 lines
830 B
Plaintext

import { upsertPreferences } from '@payloadcms/ui/rsc';
import { findLocaleFromCode } from '@payloadcms/ui/shared';
import { getPreferences } from './getPreferences.js';
export async function getRequestLocale({
req
}) {
if (req.payload.config.localization) {
const localeFromParams = req.query.locale;
if (req.user && localeFromParams) {
await upsertPreferences({
key: 'locale',
req,
value: localeFromParams
});
}
return req.user && findLocaleFromCode(req.payload.config.localization, localeFromParams || (await getPreferences('locale', req.payload, req.user.id, req.user.collection))?.value) || findLocaleFromCode(req.payload.config.localization, req.payload.config.localization.defaultLocale || 'en');
}
return undefined;
}
//# sourceMappingURL=getRequestLocale.js.map