nuxt-i18n-micro 1.26.4 → 1.27.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/README.md +1 -0
- package/dist/client/200.html +6 -6
- package/dist/client/404.html +6 -6
- package/dist/client/_nuxt/{DdNTZZXx.js → C9JTnD_j.js} +52 -52
- package/dist/client/_nuxt/{C1Wf4olg.js → C9bVPi9V.js} +1 -1
- package/dist/client/_nuxt/{r0-q9WyQ.js → D3gRF9DB.js} +1 -1
- package/dist/client/_nuxt/{CTTs5VTZ.js → DBxM89eY.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/a8ba103a-9ef6-4931-874d-27f2a7538974.json +1 -0
- package/dist/client/index.html +6 -6
- package/dist/module.d.mts +0 -1
- package/dist/module.d.ts +0 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -2
- package/dist/runtime/composables/useI18n.js +1 -0
- package/dist/runtime/plugins/01.plugin.d.ts +3 -0
- package/dist/runtime/plugins/01.plugin.js +14 -2
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/550a2c5b-067a-43d1-9873-f052247b646e.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as a,o as i,c as u,a as e,t as r,b as c,w as l,d,e as p}from"./
|
|
1
|
+
import{_ as a,o as i,c as u,a as e,t as r,b as c,w as l,d,e as p}from"./C9JTnD_j.js";import{u as f}from"./DBxM89eY.js";const m={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},g={class:"max-w-520px text-center z-20"},h=["textContent"],b=["textContent"],x={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const n=t;return f({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[{children:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{children:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(k,o)=>{const s=p;return i(),u("div",m,[o[0]||(o[0]=e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),e("div",g,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:r(t.statusCode)},null,8,h),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:r(t.description)},null,8,b),e("div",x,[c(s,{to:"/",class:"cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"},{default:l(()=>[d(r(t.backHome),1)]),_:1})])])])}}},v=a(y,[["__scopeId","data-v-28c488d2"]]);export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as s,o as a,c as i,a as e,t as o}from"./
|
|
1
|
+
import{_ as s,o as a,c as i,a as e,t as o}from"./C9JTnD_j.js";import{u}from"./DBxM89eY.js";const l={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},c={class:"max-w-520px text-center"},d=["textContent"],p=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const r=t;return u({title:`${r.statusCode} - ${r.statusMessage} | ${r.appName}`,script:[{children:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{children:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(g,n)=>(a(),i("div",l,[n[0]||(n[0]=e("div",{class:"-bottom-1/2 fixed h-1/2 left-0 right-0 spotlight"},null,-1)),e("div",c,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:o(t.statusCode)},null,8,d),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:o(t.description)},null,8,p)])]))}},b=s(f,[["__scopeId","data-v-d6cbdfc0"]]);export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as f,r as u,f as o,g as d,h as v,j as l,k as i,l as h,m}from"./
|
|
1
|
+
import{i as f,r as u,f as o,g as d,h as v,j as l,k as i,l as h,m}from"./C9JTnD_j.js";function U(t,a={}){const e=a.head||f();if(e)return e.ssr?e.push(t,a):p(e,t,a)}function p(t,a,e={}){const s=u(!1),n=u({});o(()=>{n.value=s.value?{}:d(a)});const r=t.push(n.value,e);return v(n,c=>{r.patch(c)}),m()&&(l(()=>{r.dispose()}),i(()=>{s.value=!0}),h(()=>{s.value=!1})),r}export{U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"a8ba103a-9ef6-4931-874d-27f2a7538974","timestamp":1729277889731}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"a8ba103a-9ef6-4931-874d-27f2a7538974","timestamp":1729277889731,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<!DOCTYPE html><html data-capo=""><head><meta charset="utf-8">
|
|
2
2
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
3
3
|
<link rel="stylesheet" href="/__nuxt-i18n-micro/_nuxt/entry.BqOlM4b6.css">
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/C9JTnD_j.js">
|
|
5
5
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/B6E6ObS_.js">
|
|
6
6
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-404.C_4C5G96.css">
|
|
7
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
8
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
7
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/C9bVPi9V.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DBxM89eY.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
|
|
10
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
11
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
10
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/D3gRF9DB.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/C9JTnD_j.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},1729277902621,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"a8ba103a-9ef6-4931-874d-27f2a7538974",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -413,7 +413,7 @@ const module = defineNuxtModule({
|
|
|
413
413
|
let plural = options.plural;
|
|
414
414
|
if (typeof plural !== "string")
|
|
415
415
|
plural = plural.toString();
|
|
416
|
-
const apiBaseUrl = (options.apiBaseUrl ?? "_locales").replace(
|
|
416
|
+
const apiBaseUrl = (process.env.NUXT_I18N_APP_BASE_URL ?? options.apiBaseUrl ?? "_locales").replace(/^\/+|\/+$|\/{2,}/, "");
|
|
417
417
|
nuxt.options.runtimeConfig.public.i18nConfig = {
|
|
418
418
|
plural,
|
|
419
419
|
locales: localeManager.locales ?? [],
|
|
@@ -430,7 +430,6 @@ const module = defineNuxtModule({
|
|
|
430
430
|
routesLocaleLinks: options.routesLocaleLinks ?? {},
|
|
431
431
|
fallbackLocale: options.fallbackLocale ?? void 0,
|
|
432
432
|
dateBuild: Date.now(),
|
|
433
|
-
baseURL: nuxt.options.app.baseURL,
|
|
434
433
|
hashMode: nuxt.options?.router?.options?.hashMode ?? false,
|
|
435
434
|
globalLocaleRoutes: void 0,
|
|
436
435
|
apiBaseUrl,
|
|
@@ -17,6 +17,7 @@ export function useI18n() {
|
|
|
17
17
|
$switchLocaleRoute: nuxtApp.$switchLocaleRoute,
|
|
18
18
|
$switchLocalePath: nuxtApp.$switchLocalePath,
|
|
19
19
|
$switchLocale: nuxtApp.$switchLocale,
|
|
20
|
+
$switchRoute: nuxtApp.$switchRoute,
|
|
20
21
|
$localeRoute: nuxtApp.$localeRoute,
|
|
21
22
|
$localePath: nuxtApp.$localePath
|
|
22
23
|
};
|
|
@@ -26,6 +26,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
26
26
|
switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
|
|
27
27
|
switchLocalePath: (toLocale: string) => string;
|
|
28
28
|
switchLocale: (toLocale: string) => void;
|
|
29
|
+
switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
|
|
29
30
|
localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationResolved;
|
|
30
31
|
localePath: (to: RouteLocationRaw, locale?: string) => string;
|
|
31
32
|
setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
|
|
@@ -46,6 +47,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
46
47
|
switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
|
|
47
48
|
switchLocalePath: (toLocale: string) => string;
|
|
48
49
|
switchLocale: (toLocale: string) => void;
|
|
50
|
+
switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
|
|
49
51
|
localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationResolved;
|
|
50
52
|
localePath: (to: RouteLocationRaw, locale?: string) => string;
|
|
51
53
|
setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
|
|
@@ -66,6 +68,7 @@ export interface PluginsInjections {
|
|
|
66
68
|
$switchLocaleRoute: (locale: string) => RouteLocationRaw;
|
|
67
69
|
$switchLocalePath: (locale: string) => string;
|
|
68
70
|
$switchLocale: (locale: string) => void;
|
|
71
|
+
$switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
|
|
69
72
|
$localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationResolved;
|
|
70
73
|
$localePath: (to: RouteLocationRaw, locale?: string) => string;
|
|
71
74
|
$setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
|
|
@@ -122,6 +122,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
122
122
|
const i18nConfig = config.public.i18nConfig;
|
|
123
123
|
const plural = new Function("return " + i18nConfig.plural.toString())();
|
|
124
124
|
const apiBaseUrl = i18nConfig.apiBaseUrl ?? "_locales";
|
|
125
|
+
const runtimeConfig = useRuntimeConfig();
|
|
125
126
|
const loadTranslationsIfNeeded = async (locale, routeName) => {
|
|
126
127
|
try {
|
|
127
128
|
if (!i18nHelper.hasPageTranslation(locale, routeName)) {
|
|
@@ -129,7 +130,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
129
130
|
if (i18nConfig.routesLocaleLinks && i18nConfig.routesLocaleLinks[fRouteName]) {
|
|
130
131
|
fRouteName = i18nConfig.routesLocaleLinks[fRouteName];
|
|
131
132
|
}
|
|
132
|
-
const data = await $fetch(`/${apiBaseUrl}/${fRouteName}/${locale}/data.json?v=${i18nConfig.dateBuild}`, { baseURL:
|
|
133
|
+
const data = await $fetch(`/${apiBaseUrl}/${fRouteName}/${locale}/data.json?v=${i18nConfig.dateBuild}`, { baseURL: runtimeConfig.app.baseURL });
|
|
133
134
|
await i18nHelper.loadPageTranslations(locale, routeName, data ?? {});
|
|
134
135
|
}
|
|
135
136
|
} catch (_error) {
|
|
@@ -139,7 +140,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
139
140
|
const hashLocale2 = i18nConfig.hashMode ? nuxtApp.runWithContext(() => (useCookie("hash-locale").value ?? i18nConfig.defaultLocale).toString()).toString() : null;
|
|
140
141
|
const locale = getCurrentLocale(to, i18nConfig, hashLocale2);
|
|
141
142
|
if (!i18nHelper.hasGeneralTranslation(locale)) {
|
|
142
|
-
const data = await $fetch(`/${apiBaseUrl}/general/${locale}/data.json?v=${i18nConfig.dateBuild}`, { baseURL:
|
|
143
|
+
const data = await $fetch(`/${apiBaseUrl}/general/${locale}/data.json?v=${i18nConfig.dateBuild}`, { baseURL: runtimeConfig.app.baseURL });
|
|
143
144
|
await i18nHelper.loadTranslations(locale, data ?? {});
|
|
144
145
|
}
|
|
145
146
|
if (!i18nConfig.disablePageLocales) {
|
|
@@ -247,6 +248,17 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
247
248
|
}
|
|
248
249
|
switchLocale(fromLocale, toLocale, route, router, i18nConfig, i18nRouteParams.value);
|
|
249
250
|
},
|
|
251
|
+
switchRoute: (route, toLocale) => {
|
|
252
|
+
const router = useRouter();
|
|
253
|
+
if (typeof route === "string") {
|
|
254
|
+
route = router.resolve(route);
|
|
255
|
+
}
|
|
256
|
+
const fromLocale = getCurrentLocale(route, i18nConfig, hashLocale);
|
|
257
|
+
if (i18nConfig.hashMode) {
|
|
258
|
+
hashLocale = toLocale ?? fromLocale;
|
|
259
|
+
}
|
|
260
|
+
switchLocale(fromLocale, toLocale ?? fromLocale, route, router, i18nConfig, i18nRouteParams.value);
|
|
261
|
+
},
|
|
250
262
|
localeRoute: (to, locale) => {
|
|
251
263
|
const router = useRouter();
|
|
252
264
|
const route = useRoute();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.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":"550a2c5b-067a-43d1-9873-f052247b646e","timestamp":1729244800341,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|