nuxtseo-shared 5.3.15 → 5.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/i18n.mjs +23 -1
- package/dist/module.json +1 -1
- package/package.json +1 -1
package/dist/i18n.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getNuxtModuleVersion, hasNuxtModuleCompatibility, hasNuxtModule } from '@nuxt/kit';
|
|
2
2
|
import { withHttps, withBase } from 'ufo';
|
|
3
|
-
import { localePath, resolveLocaleAlternates, resolveLocaleFromRoute } from './i18n-runtime.mjs';
|
|
3
|
+
import { localePath, resolveLocaleAlternates, resolveI18nDomain, resolveLocaleFromRoute } from './i18n-runtime.mjs';
|
|
4
4
|
import { getNuxtModuleOptions } from './kit.mjs';
|
|
5
5
|
import 'node:url';
|
|
6
6
|
import 'pathe';
|
|
@@ -26,6 +26,28 @@ function generatePathForI18nPages(ctx) {
|
|
|
26
26
|
return locale?.domain ? withHttps(withBase(path, locale.domain)) : path;
|
|
27
27
|
}
|
|
28
28
|
function splitPathForI18nLocales(path, autoI18n) {
|
|
29
|
+
if (autoI18n.multiDomainLocales && path && !path.startsWith("/_")) {
|
|
30
|
+
const i18n2 = toRuntimeI18nConfig(autoI18n);
|
|
31
|
+
const hosts = [...new Set(i18n2.locales.flatMap((locale) => [
|
|
32
|
+
...locale.domains || [],
|
|
33
|
+
...locale.defaultForDomains || [],
|
|
34
|
+
...locale.domain ? [locale.domain] : []
|
|
35
|
+
]))];
|
|
36
|
+
if (hosts.length) {
|
|
37
|
+
const normalizedPath2 = path.startsWith("/") ? path : `/${path}`;
|
|
38
|
+
if (i18n2.locales.some((locale) => normalizedPath2 === `/${locale.code}` || normalizedPath2.startsWith(`/${locale.code}/`)))
|
|
39
|
+
return path;
|
|
40
|
+
const paths = /* @__PURE__ */ new Set([path]);
|
|
41
|
+
for (const host of hosts) {
|
|
42
|
+
for (const locale of resolveI18nDomain(host, i18n2).locales) {
|
|
43
|
+
paths.add(localePath(path, locale.code, i18n2, { host }));
|
|
44
|
+
if (i18n2.strategy === "prefix_and_default")
|
|
45
|
+
paths.add(localePath(path, locale.code, { ...i18n2, strategy: "prefix" }, { host }));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return [...paths];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
29
51
|
const selectedLocales = autoI18n.strategy === "prefix_except_default" ? autoI18n.locales.filter((l) => l.code !== autoI18n.defaultLocale) : autoI18n.locales;
|
|
30
52
|
if (!path || path.startsWith("/_"))
|
|
31
53
|
return path;
|
package/dist/module.json
CHANGED