create project
This commit is contained in:
20
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js
generated
vendored
Normal file
20
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export function detectDomainLocale(domainItems, hostname, detectedLocale) {
|
||||
let domainItem;
|
||||
if (domainItems) {
|
||||
if (detectedLocale) {
|
||||
detectedLocale = detectedLocale.toLowerCase();
|
||||
}
|
||||
for (const item of domainItems){
|
||||
var ref, ref1;
|
||||
// remove port if present
|
||||
const domainHostname = (ref = item.domain) == null ? void 0 : ref.split(':')[0].toLowerCase();
|
||||
if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || ((ref1 = item.locales) == null ? void 0 : ref1.some((locale)=>locale.toLowerCase() === detectedLocale))) {
|
||||
domainItem = item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return domainItem;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=detect-domain-locale.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-domain-locale.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../shared/lib/i18n/detect-domain-locale.ts"],"names":["detectDomainLocale","domainItems","hostname","detectedLocale","domainItem","toLowerCase","item","domainHostname","domain","split","defaultLocale","locales","some","locale"],"mappings":"AAEA,OAAO,SAASA,kBAAkB,CAChCC,WAA4B,EAC5BC,QAAiB,EACjBC,cAAuB,EACvB;IACA,IAAIC,UAAU,AAA0B;IAExC,IAAIH,WAAW,EAAE;QACf,IAAIE,cAAc,EAAE;YAClBA,cAAc,GAAGA,cAAc,CAACE,WAAW,EAAE;SAC9C;QAED,KAAK,MAAMC,IAAI,IAAIL,WAAW,CAAE;gBAEPK,GAAW,EAIhCA,IAAY;YALd,yBAAyB;YACzB,MAAMC,cAAc,GAAGD,CAAAA,GAAW,GAAXA,IAAI,CAACE,MAAM,SAAO,GAAlBF,KAAAA,CAAkB,GAAlBA,GAAW,CAAEG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAACJ,WAAW,EAAE;YAC/D,IACEH,QAAQ,KAAKK,cAAc,IAC3BJ,cAAc,KAAKG,IAAI,CAACI,aAAa,CAACL,WAAW,EAAE,KACnDC,CAAAA,IAAY,GAAZA,IAAI,CAACK,OAAO,SAAM,GAAlBL,KAAAA,CAAkB,GAAlBA,IAAY,CAAEM,IAAI,CAAC,CAACC,MAAM,GAAKA,MAAM,CAACR,WAAW,EAAE,KAAKF,cAAc,CAAC,CAAA,EACvE;gBACAC,UAAU,GAAGE,IAAI;gBACjB,MAAK;aACN;SACF;KACF;IAED,OAAOF,UAAU,CAAA;CAClB"}
|
||||
6
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-locale-cookie.js
generated
vendored
Normal file
6
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-locale-cookie.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export function detectLocaleCookie(req, locales) {
|
||||
const { NEXT_LOCALE } = req.cookies || {};
|
||||
return NEXT_LOCALE ? locales.find((locale)=>NEXT_LOCALE.toLowerCase() === locale.toLowerCase()) : undefined;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=detect-locale-cookie.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-locale-cookie.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/detect-locale-cookie.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../shared/lib/i18n/detect-locale-cookie.ts"],"names":["detectLocaleCookie","req","locales","NEXT_LOCALE","cookies","find","locale","toLowerCase","undefined"],"mappings":"AAEA,OAAO,SAASA,kBAAkB,CAACC,GAAoB,EAAEC,OAAiB,EAAE;IAC1E,MAAM,EAAEC,WAAW,CAAA,EAAE,GAAG,AAACF,GAAG,CAASG,OAAO,IAAI,EAAE;IAClD,OAAOD,WAAW,GACdD,OAAO,CAACG,IAAI,CACV,CAACC,MAAc,GAAKH,WAAW,CAACI,WAAW,EAAE,KAAKD,MAAM,CAACC,WAAW,EAAE,CACvE,GACDC,SAAS,CAAA;CACd"}
|
||||
50
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js
generated
vendored
Normal file
50
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import _extends from "@swc/helpers/src/_extends.mjs";
|
||||
import { acceptLanguage } from '../../../server/accept-header';
|
||||
import { denormalizePagePath } from '../page-path/denormalize-page-path';
|
||||
import { detectDomainLocale } from './detect-domain-locale';
|
||||
import { formatUrl } from '../router/utils/format-url';
|
||||
import { getCookieParser } from '../../../server/api-utils';
|
||||
function getLocaleFromCookie(i18n, headers = {}) {
|
||||
var ref, ref1;
|
||||
const nextLocale = (ref = getCookieParser(headers || {})()) == null ? void 0 : (ref1 = ref.NEXT_LOCALE) == null ? void 0 : ref1.toLowerCase();
|
||||
return nextLocale ? i18n.locales.find((locale)=>nextLocale === locale.toLowerCase()) : undefined;
|
||||
}
|
||||
function detectLocale({ i18n , headers , domainLocale , preferredLocale , pathLocale }) {
|
||||
return pathLocale || (domainLocale == null ? void 0 : domainLocale.defaultLocale) || getLocaleFromCookie(i18n, headers) || preferredLocale || i18n.defaultLocale;
|
||||
}
|
||||
function getAcceptPreferredLocale(i18n, headers) {
|
||||
if ((headers == null ? void 0 : headers['accept-language']) && !Array.isArray(headers['accept-language'])) {
|
||||
try {
|
||||
return acceptLanguage(headers['accept-language'], i18n.locales);
|
||||
} catch (err) {}
|
||||
}
|
||||
}
|
||||
export function getLocaleRedirect({ defaultLocale , domainLocale , pathLocale , headers , nextConfig , urlParsed }) {
|
||||
if (nextConfig.i18n && nextConfig.i18n.localeDetection !== false && denormalizePagePath(urlParsed.pathname) === '/') {
|
||||
const preferredLocale = getAcceptPreferredLocale(nextConfig.i18n, headers);
|
||||
const detectedLocale = detectLocale({
|
||||
i18n: nextConfig.i18n,
|
||||
preferredLocale,
|
||||
headers,
|
||||
pathLocale,
|
||||
domainLocale
|
||||
});
|
||||
const preferredDomain = detectDomainLocale(nextConfig.i18n.domains, undefined, preferredLocale);
|
||||
if (domainLocale && preferredDomain) {
|
||||
const isPDomain = preferredDomain.domain === domainLocale.domain;
|
||||
const isPLocale = preferredDomain.defaultLocale === preferredLocale;
|
||||
if (!isPDomain || !isPLocale) {
|
||||
const scheme = `http${preferredDomain.http ? '' : 's'}`;
|
||||
const rlocale = isPLocale ? '' : preferredLocale;
|
||||
return `${scheme}://${preferredDomain.domain}/${rlocale}`;
|
||||
}
|
||||
}
|
||||
if (detectedLocale.toLowerCase() !== defaultLocale.toLowerCase()) {
|
||||
return formatUrl(_extends({}, urlParsed, {
|
||||
pathname: `${nextConfig.basePath || ''}/${detectedLocale}`
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=get-locale-redirect.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/get-locale-redirect.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../shared/lib/i18n/get-locale-redirect.ts"],"names":["acceptLanguage","denormalizePagePath","detectDomainLocale","formatUrl","getCookieParser","getLocaleFromCookie","i18n","headers","nextLocale","NEXT_LOCALE","toLowerCase","locales","find","locale","undefined","detectLocale","domainLocale","preferredLocale","pathLocale","defaultLocale","getAcceptPreferredLocale","Array","isArray","err","getLocaleRedirect","nextConfig","urlParsed","localeDetection","pathname","detectedLocale","preferredDomain","domains","isPDomain","domain","isPLocale","scheme","http","rlocale","basePath"],"mappings":"AAAA;AAEA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AA;aAC1D;SACF;QAED,IAAIR,cAAc,CAACnB,WAAW,EAAE,KAAKS,aAAa,CAACT,WAAW,EAAE,EAAE;YAChE,OAAOP,SAAS,CAAC,aACZuB,SAAS;gBACZE,QAAQ,EAAE,CAAC,EAAEH,UAAU,CAACa,QAAQ,IAAI,EAAE,CAAC,CAAC,EAAET,cAAc,CAAC,CAAC;cAC3D,CAAC,CAAA;SACH;KACF;CACF"}
|
||||
28
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js
generated
vendored
Normal file
28
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* For a pathname that may include a locale from a list of locales, it
|
||||
* removes the locale from the pathname returning it alongside with the
|
||||
* detected locale.
|
||||
*
|
||||
* @param pathname A pathname that may include a locale.
|
||||
* @param locales A list of locales.
|
||||
* @returns The detected locale and pathname without locale
|
||||
*/ export function normalizeLocalePath(pathname, locales) {
|
||||
let detectedLocale;
|
||||
// first item will be empty string from splitting at first char
|
||||
const pathnameParts = pathname.split('/');
|
||||
(locales || []).some((locale)=>{
|
||||
if (pathnameParts[1] && pathnameParts[1].toLowerCase() === locale.toLowerCase()) {
|
||||
detectedLocale = locale;
|
||||
pathnameParts.splice(1, 1);
|
||||
pathname = pathnameParts.join('/') || '/';
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return {
|
||||
pathname,
|
||||
detectedLocale
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=normalize-locale-path.js.map
|
||||
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js.map
generated
vendored
Normal file
1
kitabcitab/node_modules/next/dist/esm/shared/lib/i18n/normalize-locale-path.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../../shared/lib/i18n/normalize-locale-path.ts"],"names":["normalizeLocalePath","pathname","locales","detectedLocale","pathnameParts","split","some","locale","toLowerCase","splice","join"],"mappings":"AAKA;;;;;;;;GAQG,CACH,OAAO,SAASA,mBAAmB,CACjCC,QAAgB,EAChBC,OAAkB,EACN;IACZ,IAAIC,cAAc,AAAoB;IACtC,+DAA+D;IAC/D,MAAMC,aAAa,GAAGH,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC,AAExC;IAAA,CAACH,OAAO,IAAI,EAAE,CAAC,CAACI,IAAI,CAAC,CAACC,MAAM,GAAK;QAChC,IACEH,aAAa,CAAC,CAAC,CAAC,IAChBA,aAAa,CAAC,CAAC,CAAC,CAACI,WAAW,EAAE,KAAKD,MAAM,CAACC,WAAW,EAAE,EACvD;YACAL,cAAc,GAAGI,MAAM;YACvBH,aAAa,CAACK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1BR,QAAQ,GAAGG,aAAa,CAACM,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG;YACzC,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,KAAK,CAAA;KACb,CAAC;IAEF,OAAO;QACLT,QAAQ;QACRE,cAAc;KACf,CAAA;CACF"}
|
||||
Reference in New Issue
Block a user