nuxt-i18n-micro 1.55.0 → 1.56.1
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/133771c3-8571-4ce6-941a-4aebd70294a2.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.json +1 -1
- package/dist/runtime/plugins/01.plugin.js +9 -5
- package/dist/runtime/translation-server-middleware.d.ts +2 -1
- package/dist/runtime/translation-server-middleware.js +7 -4
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/af1dab1c-c3cf-4127-b3f8-8cfc1bb495ea.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BzXxbhIZ.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DWqKq_Wn.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/B85fdbn4.js">
|
|
11
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
11
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1736261599038,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"133771c3-8571-4ce6-941a-4aebd70294a2",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_DEVTOOLS_I18N_BASE__/_nuxt/BzXxbhIZ.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DWqKq_Wn.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/B85fdbn4.js">
|
|
11
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
11
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1736261599038,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"133771c3-8571-4ce6-941a-4aebd70294a2",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"133771c3-8571-4ce6-941a-4aebd70294a2","timestamp":1736261594319}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"133771c3-8571-4ce6-941a-4aebd70294a2","timestamp":1736261594319,"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_DEVTOOLS_I18N_BASE__/_nuxt/BzXxbhIZ.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DWqKq_Wn.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/B85fdbn4.js">
|
|
11
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
11
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhDLGWZB.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},1736261599038,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"133771c3-8571-4ce6-941a-4aebd70294a2",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
|
@@ -354,25 +354,29 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
354
354
|
const currentRoute = router.currentRoute.value;
|
|
355
355
|
const fromLocale = getCurrentLocale(currentRoute, i18nConfig, hashLocale, noPrefixDefault);
|
|
356
356
|
const currentLocale = toLocale ?? fromLocale;
|
|
357
|
-
|
|
357
|
+
let to = null;
|
|
358
|
+
if (typeof route === "string" && !isNoPrefixStrategy(i18nConfig.strategy)) {
|
|
358
359
|
if (currentLocale !== i18nConfig.defaultLocale || withPrefixStrategy(i18nConfig.strategy)) {
|
|
359
360
|
const currentRoute2 = router.currentRoute.value;
|
|
360
361
|
const fromLocale2 = getCurrentLocale(currentRoute2, i18nConfig, hashLocale, noPrefixDefault);
|
|
361
|
-
|
|
362
|
+
to = router.resolve("/" + fromLocale2 + route);
|
|
362
363
|
} else {
|
|
363
|
-
|
|
364
|
+
to = router.resolve(route);
|
|
364
365
|
}
|
|
365
366
|
}
|
|
366
367
|
if (i18nConfig.hashMode) {
|
|
367
368
|
hashLocale = toLocale ?? fromLocale;
|
|
368
369
|
}
|
|
369
|
-
|
|
370
|
+
if (!to) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
switchLocale(fromLocale, toLocale ?? fromLocale, to, router, i18nConfig, i18nRouteParams.value);
|
|
370
374
|
},
|
|
371
375
|
localeRoute: (to, locale) => {
|
|
372
376
|
const currentRoute = router.currentRoute.value;
|
|
373
377
|
const fromLocale = getCurrentLocale(currentRoute, i18nConfig, hashLocale, noPrefixDefault);
|
|
374
378
|
const currentLocale = locale ?? fromLocale;
|
|
375
|
-
if (typeof to === "string") {
|
|
379
|
+
if (typeof to === "string" && !isNoPrefixStrategy(i18nConfig.strategy)) {
|
|
376
380
|
if (currentLocale !== i18nConfig.defaultLocale || withPrefixStrategy(i18nConfig.strategy)) {
|
|
377
381
|
const currentRoute2 = router.currentRoute.value;
|
|
378
382
|
const fromLocale2 = getCurrentLocale(currentRoute2, i18nConfig, hashLocale, noPrefixDefault);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { H3Event } from 'h3';
|
|
2
|
-
|
|
2
|
+
import type { Params } from '../types.js';
|
|
3
|
+
export declare const useTranslationServerMiddleware: (event: H3Event, defaultLocale?: string, currentLocale?: string) => Promise<(key: string, params?: Params, defaultValue?: string) => string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getQuery, getCookie } from "h3";
|
|
2
|
-
import { useTranslationHelper } from "nuxt-i18n-micro-core";
|
|
2
|
+
import { interpolate, useTranslationHelper } from "nuxt-i18n-micro-core";
|
|
3
3
|
async function fetchTranslations(locale) {
|
|
4
4
|
try {
|
|
5
5
|
const translations = await $fetch(`/_locales/general/${locale}/data.json`);
|
|
@@ -16,9 +16,12 @@ export const useTranslationServerMiddleware = async (event, defaultLocale, curre
|
|
|
16
16
|
const translations = await fetchTranslations(locale);
|
|
17
17
|
await loadTranslations(locale, translations);
|
|
18
18
|
}
|
|
19
|
-
function t(key) {
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
function t(key, params, defaultValue) {
|
|
20
|
+
let translation = getTranslation(locale, "index", key);
|
|
21
|
+
if (!translation) {
|
|
22
|
+
translation = defaultValue || key;
|
|
23
|
+
}
|
|
24
|
+
return typeof translation === "string" && params ? interpolate(translation, params) : translation;
|
|
22
25
|
}
|
|
23
26
|
return t;
|
|
24
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.56.1",
|
|
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":"af1dab1c-c3cf-4127-b3f8-8cfc1bb495ea","timestamp":1735902513062,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|