nuxt-i18n-micro 2.17.0 → 2.18.0
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/client/200.html +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/02802819-1591-4f72-8f22-11781ae42932.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/composables/useLocaleHead.js +1 -1
- package/dist/runtime/server/routes/get.js +22 -18
- package/package.json +3 -3
- package/dist/client/_nuxt/builds/meta/217db98e-106d-4783-a13f-f1d4477a5f43.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CB1rVCw-.js">
|
|
8
8
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CMRINVjo.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DvNkspSg.js">
|
|
10
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CMoi8loD.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
10
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CMoi8loD.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1769185858458,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"02802819-1591-4f72-8f22-11781ae42932",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CB1rVCw-.js">
|
|
8
8
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CMRINVjo.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DvNkspSg.js">
|
|
10
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CMoi8loD.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
10
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CMoi8loD.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1769185858458,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"02802819-1591-4f72-8f22-11781ae42932",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"02802819-1591-4f72-8f22-11781ae42932","timestamp":1769185855623}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"02802819-1591-4f72-8f22-11781ae42932","timestamp":1769185855623,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -7,5 +7,5 @@
|
|
|
7
7
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CB1rVCw-.js">
|
|
8
8
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CMRINVjo.css">
|
|
9
9
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DvNkspSg.js">
|
|
10
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CMoi8loD.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
10
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CMoi8loD.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1769185858458,false]</script>
|
|
11
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"02802819-1591-4f72-8f22-11781ae42932",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
|
@@ -42,7 +42,7 @@ export const useLocaleHead = ({ addDirAttribute = true, identifierAttribute = "i
|
|
|
42
42
|
if (!fullPath.startsWith("/")) {
|
|
43
43
|
fullPath = `/${fullPath}`;
|
|
44
44
|
}
|
|
45
|
-
const matchedLocale = locales.find((locale2) => fullPath.startsWith(`/${locale2.code}`));
|
|
45
|
+
const matchedLocale = [...locales].sort((a, b) => b.code.length - a.code.length).find((locale2) => fullPath.startsWith(`/${locale2.code}`));
|
|
46
46
|
let localizedPath = fullPath;
|
|
47
47
|
let ogUrl;
|
|
48
48
|
let canonicalPath;
|
|
@@ -15,6 +15,20 @@ function deepMerge(target, source) {
|
|
|
15
15
|
}
|
|
16
16
|
return output;
|
|
17
17
|
}
|
|
18
|
+
function parseStorageData(data, debug = false, path) {
|
|
19
|
+
if (!data) return null;
|
|
20
|
+
if (typeof data === "string") {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.parse(data);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
if (debug) {
|
|
25
|
+
console.error(`[i18n] Error parsing storage data${path ? ` for ${path}` : ""}:`, e);
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
18
32
|
export default defineEventHandler(async (event) => {
|
|
19
33
|
setResponseHeader(event, "Content-Type", "application/json");
|
|
20
34
|
const { page, locale } = event.context.params;
|
|
@@ -51,28 +65,18 @@ export default defineEventHandler(async (event) => {
|
|
|
51
65
|
for (let i = 0; i < rootDirs.length; i++) {
|
|
52
66
|
const layerPrefix = `assets:i18n_layer_${i}`;
|
|
53
67
|
const globalKey = `${layerPrefix}:${targetLocale}.json`;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
} catch (e) {
|
|
60
|
-
if (debug) {
|
|
61
|
-
console.error(`[i18n] Error loading global translations: ${globalKey}`, e);
|
|
62
|
-
}
|
|
68
|
+
const globalContentRaw = await storage.getItem(globalKey);
|
|
69
|
+
const globalContent = parseStorageData(globalContentRaw, debug, globalKey);
|
|
70
|
+
if (globalContent) {
|
|
71
|
+
globalTranslations = deepMerge(globalTranslations, globalContent);
|
|
63
72
|
}
|
|
64
73
|
if (page !== "general") {
|
|
65
74
|
const normalizedPage = fileLookupPage.replace(/\//g, ":");
|
|
66
75
|
const pageKey = `${layerPrefix}:pages:${normalizedPage}:${targetLocale}.json`;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
} catch (e) {
|
|
73
|
-
if (debug) {
|
|
74
|
-
console.error(`[i18n] Error loading page translations: ${pageKey}`, e);
|
|
75
|
-
}
|
|
76
|
+
const pageContentRaw = await storage.getItem(pageKey);
|
|
77
|
+
const pageContent = parseStorageData(pageContentRaw, debug, pageKey);
|
|
78
|
+
if (pageContent) {
|
|
79
|
+
pageTranslations = deepMerge(pageTranslations, pageContent);
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Nuxt I18n Micro is a lightweight, high-performance internationalization module for Nuxt, designed to handle multi-language support with minimal overhead, fast build times, and efficient runtime performance.",
|
|
5
5
|
"repository": "s00d/nuxt-i18n-micro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"globby": "^14.1.0",
|
|
62
62
|
"ufo": "^1.5.4",
|
|
63
63
|
"@i18n-micro/core": "1.0.28",
|
|
64
|
-
"@i18n-micro/
|
|
65
|
-
"@i18n-micro/
|
|
64
|
+
"@i18n-micro/types": "1.0.16",
|
|
65
|
+
"@i18n-micro/test-utils": "1.0.8"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@nuxt/devtools": "^2.6.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"217db98e-106d-4783-a13f-f1d4477a5f43","timestamp":1768893600224,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|