nuxt-i18n-micro 1.16.0 → 1.16.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 +6 -6
- package/dist/client/404.html +6 -6
- package/dist/client/_nuxt/{CUbs-yQQ.js → Bii0Cy7X.js} +1 -1
- package/dist/client/_nuxt/{CCUdfIr-.js → C9hrmmtp.js} +48 -48
- package/dist/client/_nuxt/{CLjGsY26.js → DaLmbeLo.js} +1 -1
- package/dist/client/_nuxt/{BraUkLq2.js → Dvj3Ou8K.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/b6e0dab7-be9e-4ee6-8148-cf61da244e79.json +1 -0
- package/dist/client/index.html +6 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +7 -7
- package/dist/runtime/plugins/01.plugin.js +14 -1
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/613b2437-64f2-42a2-8c2d-9c1b0007ae86.json +0 -1
|
@@ -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"./C9hrmmtp.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
|
-
import{u as a}from"./
|
|
1
|
+
import{u as a}from"./DaLmbeLo.js";import{_ as s,o as i,c as u,a as t,t as o}from"./C9hrmmtp.js";const l={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},c={class:"max-w-520px text-center"},d=["textContent"],p=["textContent"],g={__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(e){const n=e;return a({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[],style:[{children:'*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;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;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:before,:after{--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 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(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: }'}]}),(b,r)=>(i(),u("div",l,[r[0]||(r[0]=t("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),t("div",c,[t("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:o(e.statusCode)},null,8,d),t("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:o(e.description)},null,8,p)])]))}},m=s(g,[["__scopeId","data-v-b63e9691"]]);export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"b6e0dab7-be9e-4ee6-8148-cf61da244e79","timestamp":1726666526425}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"b6e0dab7-be9e-4ee6-8148-cf61da244e79","timestamp":1726666526425,"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.DjxsrOxm.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/C9hrmmtp.js">
|
|
5
5
|
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/B6E6ObS_.js">
|
|
6
6
|
<link rel="prefetch" as="style" href="/__nuxt-i18n-micro/_nuxt/error-404.D-AvUzLt.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/Bii0Cy7X.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DaLmbeLo.js">
|
|
9
9
|
<link rel="prefetch" as="style" href="/__nuxt-i18n-micro/_nuxt/error-500.21ZDxC33.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/Dvj3Ou8K.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/C9hrmmtp.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__">[{"serverRendered":1},false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"b6e0dab7-be9e-4ee6-8148-cf61da244e79",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -149,12 +149,15 @@ class PageManager {
|
|
|
149
149
|
activeLocaleCodes;
|
|
150
150
|
constructor(locales, defaultLocaleCode, includeDefaultLocaleRoute) {
|
|
151
151
|
this.locales = locales;
|
|
152
|
-
this.defaultLocale = this.
|
|
152
|
+
this.defaultLocale = this.findLocaleByCode(defaultLocaleCode) || { code: defaultLocaleCode };
|
|
153
153
|
this.includeDefaultLocaleRoute = includeDefaultLocaleRoute;
|
|
154
|
-
this.activeLocaleCodes = this.
|
|
154
|
+
this.activeLocaleCodes = this.computeActiveLocaleCodes();
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
return this.locales.find((locale) => locale.code ===
|
|
156
|
+
findLocaleByCode(code) {
|
|
157
|
+
return this.locales.find((locale) => locale.code === code);
|
|
158
|
+
}
|
|
159
|
+
computeActiveLocaleCodes() {
|
|
160
|
+
return this.locales.filter((locale) => locale.code !== this.defaultLocale.code || this.includeDefaultLocaleRoute).map((locale) => locale.code);
|
|
158
161
|
}
|
|
159
162
|
extendPages(pages, rootDir) {
|
|
160
163
|
this.localizedPaths = this.extractLocalizedPaths(pages, rootDir);
|
|
@@ -162,9 +165,6 @@ class PageManager {
|
|
|
162
165
|
pages.forEach((page) => this.localizePage(page, additionalRoutes));
|
|
163
166
|
pages.push(...additionalRoutes);
|
|
164
167
|
}
|
|
165
|
-
calculateActiveLocaleCodes() {
|
|
166
|
-
return this.locales.filter((locale) => locale.code !== this.defaultLocale.code || this.includeDefaultLocaleRoute).map((locale) => locale.code);
|
|
167
|
-
}
|
|
168
168
|
extractLocalizedPaths(pages, rootDir, parentPath = "") {
|
|
169
169
|
const localizedPaths = {};
|
|
170
170
|
pages.forEach((page) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTranslationHelper } from "../translationHelper.js";
|
|
2
|
-
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
import { defineNuxtPlugin, navigateTo, useRuntimeConfig } from "#app";
|
|
3
3
|
import { useRoute, useRouter } from "#imports";
|
|
4
4
|
const i18nHelper = useTranslationHelper();
|
|
5
5
|
const isDev = process.env.NODE_ENV !== "production";
|
|
@@ -23,9 +23,16 @@ function switchLocale(fromLocale, toLocale, route, router, i18nConfig) {
|
|
|
23
23
|
return Promise.reject(`Locale ${toLocale} is not available`);
|
|
24
24
|
}
|
|
25
25
|
const routeName = getRouteName(route, fromLocale);
|
|
26
|
+
const isHashMode = router.options?.hashMode;
|
|
26
27
|
if (router.hasRoute(`localized-${routeName}-${toLocale}`)) {
|
|
27
28
|
const newParams2 = { ...route.params };
|
|
28
29
|
newParams2.locale = toLocale;
|
|
30
|
+
if (isHashMode) {
|
|
31
|
+
return navigateTo(
|
|
32
|
+
toLocale !== i18nConfig.defaultLocale ? `/${toLocale}/#/${toLocale}${route.fullPath.split("#")[1] || ""}` : `/#/${route.fullPath.split("#")[1] || ""}`,
|
|
33
|
+
{ redirectCode: 200, external: true }
|
|
34
|
+
);
|
|
35
|
+
}
|
|
29
36
|
return router.push({
|
|
30
37
|
params: newParams2,
|
|
31
38
|
name: `localized-${routeName}-${toLocale}`
|
|
@@ -37,6 +44,12 @@ function switchLocale(fromLocale, toLocale, route, router, i18nConfig) {
|
|
|
37
44
|
if (toLocale !== i18nConfig.defaultLocale || i18nConfig.includeDefaultLocaleRoute) {
|
|
38
45
|
newParams.locale = toLocale;
|
|
39
46
|
}
|
|
47
|
+
if (isHashMode) {
|
|
48
|
+
return navigateTo(
|
|
49
|
+
toLocale !== i18nConfig.defaultLocale ? `/${toLocale}/#/${toLocale}${route.fullPath.split("#")[1] || ""}` : `/#/${route.fullPath.split("#")[1] || ""}`,
|
|
50
|
+
{ redirectCode: 200, external: true }
|
|
51
|
+
);
|
|
52
|
+
}
|
|
40
53
|
return router.push({ name: newRouteName, params: newParams });
|
|
41
54
|
}
|
|
42
55
|
function getLocalizedRoute(to, router, route, i18nConfig, locale) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.16.
|
|
3
|
+
"version": "1.16.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":"613b2437-64f2-42a2-8c2d-9c1b0007ae86","timestamp":1726489011724,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|