lingjing/node_modules/next/dist/shared/lib/i18n/detect-domain-locale.js
2026-02-23 09:51:43 +00:00

25 lines
821 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "detectDomainLocale", {
enumerable: true,
get: function() {
return detectDomainLocale;
}
});
function detectDomainLocale(domainItems, hostname, detectedLocale) {
if (!domainItems) return;
if (detectedLocale) {
detectedLocale = detectedLocale.toLowerCase();
}
for (const item of domainItems){
// remove port if present
const domainHostname = item.domain?.split(':', 1)[0].toLowerCase();
if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || item.locales?.some((locale)=>locale.toLowerCase() === detectedLocale)) {
return item;
}
}
}
//# sourceMappingURL=detect-domain-locale.js.map