Files
klz-cables.com/.pnpm-store/v10/files/c0/0cd20a31abb990a7476825cfb5a49043dea8a86eb97dd0a75fba28dfe8d7fbf461b408eb5aa3bbf0617335ba287c457905039aa281d6425df3b74204cae8a9
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

39 lines
1.4 KiB
Plaintext

import { cache } from 'react';
import getServerTranslator from './getServerTranslator.js';
// Note: This API is usually compiled into `useTranslations`,
// but there is some fallback handling which allows this hook
// to still work when not being compiled.
//
// This is relevant for:
// - Isolated environments like tests, Storybook, etc.
// - Fallbacks in case an extracted message is not yet available
function getServerExtractorImpl(config, namespace) {
const t = getServerTranslator(config, namespace);
function translateFn(...[message, values, formats]) {
return t(undefined, values, formats,
// @ts-expect-error -- Secret fallback parameter
message );
}
translateFn.rich = function translateRichFn(...[message, values, formats]) {
return t.rich(undefined, values, formats,
// @ts-expect-error -- Secret fallback parameter
message );
};
translateFn.markup = function translateMarkupFn(...[message, values, formats]) {
return t.markup(undefined, values, formats,
// @ts-expect-error -- Secret fallback parameter
message );
};
translateFn.has = function translateHasFn(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
...[message]) {
// Not really something better we can do here
return true;
};
return translateFn;
}
var getServerExtractor = cache(getServerExtractorImpl);
export { getServerExtractor as default };