@nuxtjs/i18n-edge 9.4.0-29052894.90f4e7f → 9.4.0-29054232.cc2e8a8
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/module.json +1 -1
- package/dist/module.mjs +0 -2
- package/dist/runtime/internal.js +11 -19
- package/package.json +2 -3
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -32,7 +32,6 @@ const H3_PKG = "@intlify/h3";
|
|
|
32
32
|
const UTILS_PKG = "@intlify/utils";
|
|
33
33
|
const UTILS_H3_PKG = "@intlify/utils/h3";
|
|
34
34
|
const UFO_PKG = "ufo";
|
|
35
|
-
const IS_HTTPS_PKG = "is-https";
|
|
36
35
|
const STRATEGY_PREFIX_EXCEPT_DEFAULT = "prefix_except_default";
|
|
37
36
|
const DEFAULT_DYNAMIC_PARAMS_KEY = "nuxtI18nInternal";
|
|
38
37
|
const DEFAULT_COOKIE_KEY = "i18n_redirected";
|
|
@@ -117,7 +116,6 @@ async function setupAlias({ userOptions: options, isDev, isPrepare }, nuxt) {
|
|
|
117
116
|
modules[CORE_PKG] = `${CORE_PKG}/dist/core.node.mjs`;
|
|
118
117
|
modules[UTILS_H3_PKG] = `${UTILS_PKG}/dist/h3.mjs`;
|
|
119
118
|
modules[UFO_PKG] = UFO_PKG;
|
|
120
|
-
modules[IS_HTTPS_PKG] = IS_HTTPS_PKG;
|
|
121
119
|
const moduleDirs = nuxt.options.modulesDir || [];
|
|
122
120
|
const enhancedModulesDirs = [...moduleDirs, ...moduleDirs.map((dir) => `${dir}/${NUXT_I18N_MODULE_ID}/node_modules`)];
|
|
123
121
|
for (const [moduleName, moduleFile] of Object.entries(modules)) {
|
package/dist/runtime/internal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isArray, isString, isObject } from "@intlify/shared";
|
|
2
2
|
import { hasProtocol } from "ufo";
|
|
3
|
-
import
|
|
3
|
+
import { getRequestProtocol } from "h3";
|
|
4
4
|
import {
|
|
5
5
|
useRequestHeaders,
|
|
6
6
|
useRequestEvent,
|
|
@@ -233,28 +233,20 @@ export function getLocaleDomain(locales, strategy, route) {
|
|
|
233
233
|
return host;
|
|
234
234
|
}
|
|
235
235
|
export function getDomainFromLocale(localeCode) {
|
|
236
|
-
const runtimeConfig = useRuntimeConfig();
|
|
237
236
|
const nuxtApp = useNuxtApp();
|
|
238
237
|
const host = getHost();
|
|
239
|
-
const
|
|
238
|
+
const runtimeI18n = useRuntimeConfig().public.i18n;
|
|
240
239
|
const lang = normalizedLocales.find((locale) => locale.code === localeCode);
|
|
241
|
-
const domain =
|
|
242
|
-
if (domain) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
const {
|
|
249
|
-
node: { req }
|
|
250
|
-
} = useRequestEvent(nuxtApp);
|
|
251
|
-
protocol = req && isHTTPS(req) ? "https:" : "http:";
|
|
252
|
-
} else {
|
|
253
|
-
protocol = new URL(window.location.origin).protocol;
|
|
254
|
-
}
|
|
255
|
-
return protocol + "//" + domain;
|
|
240
|
+
const domain = runtimeI18n?.domainLocales?.[localeCode]?.domain || lang?.domain || lang?.domains?.find((v) => v === host);
|
|
241
|
+
if (!domain) {
|
|
242
|
+
console.warn(formatMessage("Could not find domain name for locale " + localeCode));
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (hasProtocol(domain, { strict: true })) {
|
|
246
|
+
return domain;
|
|
256
247
|
}
|
|
257
|
-
|
|
248
|
+
const protocol = import.meta.server ? getRequestProtocol(useRequestEvent(nuxtApp)) + ":" : new URL(window.location.origin).protocol;
|
|
249
|
+
return protocol + "//" + domain;
|
|
258
250
|
}
|
|
259
251
|
export const runtimeDetectBrowserLanguage = (opts = useRuntimeConfig().public.i18n) => {
|
|
260
252
|
if (opts?.detectBrowserLanguage === false) return false;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxtjs/i18n-edge",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.4.0-
|
|
4
|
+
"version": "9.4.0-29054232.cc2e8a8",
|
|
5
5
|
"packageManager": "pnpm@10.6.5",
|
|
6
6
|
"description": "Internationalization for Nuxt",
|
|
7
7
|
"contributors": [
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"defu": "^6.1.4",
|
|
101
101
|
"esbuild": "^0.25.1",
|
|
102
102
|
"estree-walker": "^3.0.3",
|
|
103
|
-
"
|
|
103
|
+
"h3": "^1.15.1",
|
|
104
104
|
"knitwork": "^1.2.0",
|
|
105
105
|
"magic-string": "^0.30.17",
|
|
106
106
|
"mlly": "^1.7.4",
|
|
@@ -129,7 +129,6 @@
|
|
|
129
129
|
"get-port-please": "^3.1.2",
|
|
130
130
|
"gh-changelogen": "^0.2.8",
|
|
131
131
|
"globals": "^16.0.0",
|
|
132
|
-
"h3": "^1.15.1",
|
|
133
132
|
"jiti": "^2.4.2",
|
|
134
133
|
"jsdom": "^24.1.3",
|
|
135
134
|
"knip": "^5.46.1",
|