nuxt-i18n-micro 1.33.3 → 1.34.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/a88f9407-2b55-410b-a3fb-1453f7918998.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/plugins/01.plugin.js +4 -2
- package/dist/runtime/translationHelper.js +16 -9
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/33b6fef3-50ca-429d-9974-e768abf0f6c7.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CBccCxXK.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.Bkv_zTjr.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DNen4El9.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/n4MbYZHF.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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/n4MbYZHF.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},1732830066955,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"a88f9407-2b55-410b-a3fb-1453f7918998",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CBccCxXK.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.Bkv_zTjr.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DNen4El9.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/n4MbYZHF.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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/n4MbYZHF.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},1732830066956,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"a88f9407-2b55-410b-a3fb-1453f7918998",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"a88f9407-2b55-410b-a3fb-1453f7918998","timestamp":1732830053812}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"a88f9407-2b55-410b-a3fb-1453f7918998","timestamp":1732830053812,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CBccCxXK.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.Bkv_zTjr.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DNen4El9.js">
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/n4MbYZHF.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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/n4MbYZHF.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},1732830066956,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"a88f9407-2b55-410b-a3fb-1453f7918998",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
|
@@ -218,14 +218,16 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
218
218
|
const hashLocale2 = i18nConfig.hashMode ? nuxtApp.runWithContext(() => (useCookie("hash-locale").value ?? i18nConfig.defaultLocale).toString()).toString() : null;
|
|
219
219
|
const locale = getCurrentLocale(to, i18nConfig, hashLocale2);
|
|
220
220
|
if (!i18nHelper.hasGeneralTranslation(locale)) {
|
|
221
|
-
const data = await $fetch(`/${apiBaseUrl}/general/${locale}/data.json?v=${i18nConfig.dateBuild}`, {
|
|
221
|
+
const data = await $fetch(`/${apiBaseUrl}/general/${locale}/data.json?v=${i18nConfig.dateBuild}`, {
|
|
222
|
+
baseURL: runtimeConfig.app.baseURL
|
|
223
|
+
});
|
|
222
224
|
await i18nHelper.loadTranslations(locale, data ?? {});
|
|
223
225
|
}
|
|
224
226
|
if (!i18nConfig.disablePageLocales) {
|
|
225
227
|
const routeName = getRouteName(to, locale);
|
|
226
228
|
await loadTranslationsIfNeeded(locale, routeName, to.fullPath);
|
|
227
229
|
}
|
|
228
|
-
|
|
230
|
+
nuxtApp.callHook("i18n:register", (translations, selectedLocale) => {
|
|
229
231
|
const routeName = getRouteName(to, locale);
|
|
230
232
|
i18nHelper.mergeTranslation(selectedLocale ?? locale, routeName, translations, true);
|
|
231
233
|
}, locale);
|
|
@@ -11,13 +11,21 @@ function deepClone(value) {
|
|
|
11
11
|
}
|
|
12
12
|
return value;
|
|
13
13
|
}
|
|
14
|
-
function findTranslation(translations,
|
|
14
|
+
function findTranslation(translations, key) {
|
|
15
15
|
let value = translations;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
if (translations === null) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
if (translations[key]) {
|
|
20
|
+
value = translations[key];
|
|
21
|
+
} else {
|
|
22
|
+
const parts = key.split(".");
|
|
23
|
+
for (const part of parts) {
|
|
24
|
+
if (value && typeof value === "object" && part in value) {
|
|
25
|
+
value = value[part];
|
|
26
|
+
} else {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
21
29
|
}
|
|
22
30
|
}
|
|
23
31
|
if (typeof value === "object" && value !== null) {
|
|
@@ -69,14 +77,13 @@ export function useTranslationHelper() {
|
|
|
69
77
|
if (cached) {
|
|
70
78
|
return cached;
|
|
71
79
|
}
|
|
72
|
-
const parts = key.split(".");
|
|
73
80
|
let result = null;
|
|
74
81
|
for (const dynamicCache of dynamicTranslationsCaches) {
|
|
75
|
-
result = findTranslation(dynamicCache[locale] || null,
|
|
82
|
+
result = findTranslation(dynamicCache[locale] || null, key);
|
|
76
83
|
if (result !== null) break;
|
|
77
84
|
}
|
|
78
85
|
if (!result) {
|
|
79
|
-
result = findTranslation(routeLocaleCache[cacheKey] || null,
|
|
86
|
+
result = findTranslation(routeLocaleCache[cacheKey] || null, key) ?? findTranslation(generalLocaleCache[locale] || null, key);
|
|
80
87
|
}
|
|
81
88
|
if (result) {
|
|
82
89
|
if (!serverTranslationCache[cacheKey]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.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",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"33b6fef3-50ca-429d-9974-e768abf0f6c7","timestamp":1732788587984,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|