nuxt-i18n-micro 1.29.0 → 1.29.2
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/{CKE-slgQ.js → D8Lez-Ba.js} +1 -1
- package/dist/client/_nuxt/{mVL4Ag1z.js → DPXS1ORf.js} +52 -52
- package/dist/client/_nuxt/{CtNJ_juG.js → DwTifKvh.js} +1 -1
- package/dist/client/_nuxt/{B3qz2zap.js → DxRkfQGy.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/e18fbf0a-a21f-43a7-bdc0-7397e9d5fecd.json +1 -0
- package/dist/client/index.html +6 -6
- package/dist/module.d.mts +1 -0
- package/dist/module.d.ts +1 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/i18n-link.vue +4 -0
- package/dist/runtime/components/i18n-switcher.vue +17 -1
- package/dist/runtime/components/i18n-t.vue +5 -4
- package/dist/runtime/components/i18n-t.vue.d.ts +1 -1
- package/dist/runtime/composables/useLocaleHead.js +1 -1
- package/dist/runtime/plugins/01.plugin.js +4 -1
- package/dist/runtime/plugins/03.define.js +2 -2
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +2 -1
- package/dist/client/_nuxt/builds/meta/586a38c7-df12-4fac-ae0d-f67dd0448804.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"./DPXS1ORf.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{_ 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"./DPXS1ORf.js";import{u as f}from"./DwTifKvh.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
|
-
{"id":"
|
|
1
|
+
{"id":"e18fbf0a-a21f-43a7-bdc0-7397e9d5fecd","timestamp":1729513595545}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"e18fbf0a-a21f-43a7-bdc0-7397e9d5fecd","timestamp":1729513595545,"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/DPXS1ORf.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/DxRkfQGy.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DwTifKvh.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/D8Lez-Ba.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/DPXS1ORf.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},1729513610715,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"e18fbf0a-a21f-43a7-bdc0-7397e9d5fecd",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
package/dist/module.d.ts
CHANGED
package/dist/module.json
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
import type { RouteLocationRaw } from 'vue-router'
|
|
12
12
|
import { useNuxtApp, computed, useRoute, useRouter } from '#imports'
|
|
13
13
|
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-ignore
|
|
14
16
|
const { $localeRoute } = useNuxtApp()
|
|
15
17
|
|
|
16
18
|
interface Props {
|
|
@@ -23,6 +25,8 @@ const route = useRoute()
|
|
|
23
25
|
|
|
24
26
|
const isActive = computed(() => {
|
|
25
27
|
// If `to` is a string, compare it directly to the route path
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
29
|
+
// @ts-ignore
|
|
26
30
|
const newPath = $localeRoute(props.to)
|
|
27
31
|
if (typeof newPath === 'string') {
|
|
28
32
|
return route.path === useRouter().resolve(newPath).path
|
|
@@ -39,10 +39,18 @@
|
|
|
39
39
|
<script lang="ts" setup>
|
|
40
40
|
import { ref, computed } from 'vue'
|
|
41
41
|
import type { CSSProperties } from 'vue'
|
|
42
|
-
import type { Locale } from '../../types'
|
|
43
42
|
import { useNuxtApp } from '#app'
|
|
44
43
|
import { useRoute } from '#imports'
|
|
45
44
|
|
|
45
|
+
type LocaleCode = string
|
|
46
|
+
interface Locale {
|
|
47
|
+
code: LocaleCode
|
|
48
|
+
disabled?: boolean
|
|
49
|
+
iso?: string
|
|
50
|
+
dir?: 'ltr' | 'rtl' | 'auto'
|
|
51
|
+
displayName?: string
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
interface Props {
|
|
47
55
|
customLabels?: Record<string, string>
|
|
48
56
|
customWrapperStyle?: CSSProperties
|
|
@@ -68,8 +76,14 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
68
76
|
})
|
|
69
77
|
|
|
70
78
|
const { $localeRoute, $getLocales, $getLocale, $getLocaleName } = useNuxtApp()
|
|
79
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
80
|
+
// @ts-ignore
|
|
71
81
|
const locales = ref($getLocales())
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
83
|
+
// @ts-ignore
|
|
72
84
|
const currentLocale = computed(() => $getLocale())
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
86
|
+
// @ts-ignore
|
|
73
87
|
const currentLocaleName = computed(() => $getLocaleName())
|
|
74
88
|
const dropdownOpen = ref(false)
|
|
75
89
|
|
|
@@ -100,6 +114,8 @@ const getLocaleLink = (locale: Locale) => {
|
|
|
100
114
|
.replace(new RegExp(`-${currentLocale.value}$`), '')
|
|
101
115
|
.replace(new RegExp(`-${locale}$`), '')
|
|
102
116
|
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
118
|
+
// @ts-ignore
|
|
103
119
|
return $localeRoute({ name: routeName }, locale.code)
|
|
104
120
|
}
|
|
105
121
|
|
|
@@ -39,19 +39,20 @@ export default defineComponent({
|
|
|
39
39
|
setup(props, { slots, attrs }) {
|
|
40
40
|
return () => {
|
|
41
41
|
const options = {};
|
|
42
|
+
const { $getLocale, $t, $tc } = useNuxtApp().$i18n;
|
|
42
43
|
if (props.plural !== void 0) {
|
|
43
44
|
if (props.customPluralRule) {
|
|
44
45
|
return h(props.tag, { ...attrs, innerHTML: props.customPluralRule(
|
|
45
46
|
props.keypath,
|
|
46
47
|
Number.parseInt(props.plural.toString()),
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
$getLocale(),
|
|
49
|
+
$t
|
|
49
50
|
) });
|
|
50
51
|
} else {
|
|
51
|
-
return h(props.tag, { ...attrs, innerHTML:
|
|
52
|
+
return h(props.tag, { ...attrs, innerHTML: $tc(props.keypath, Number.parseInt(props.plural.toString())) });
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
const translation = (
|
|
55
|
+
const translation = ($t(props.keypath, { ...props.params, ...options }) ?? "").toString();
|
|
55
56
|
if (props.hideIfEmpty && !translation.trim()) {
|
|
56
57
|
return props.defaultValue ?? null;
|
|
57
58
|
}
|
|
@@ -67,8 +67,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
67
|
default: null;
|
|
68
68
|
};
|
|
69
69
|
}>> & Readonly<{}>, {
|
|
70
|
-
tag: string;
|
|
71
70
|
params: Record<string, string | number | boolean>;
|
|
71
|
+
tag: string;
|
|
72
72
|
defaultValue: string;
|
|
73
73
|
html: boolean;
|
|
74
74
|
hideIfEmpty: boolean;
|
|
@@ -8,7 +8,7 @@ export const useLocaleHead = ({ addDirAttribute = true, identifierAttribute = "i
|
|
|
8
8
|
});
|
|
9
9
|
function updateMeta() {
|
|
10
10
|
const { defaultLocale, includeDefaultLocaleRoute } = useRuntimeConfig().public.i18nConfig;
|
|
11
|
-
const { $getLocales, $getLocale } = useNuxtApp();
|
|
11
|
+
const { $getLocales, $getLocale } = useNuxtApp().$i18n;
|
|
12
12
|
const route = useRoute();
|
|
13
13
|
const locale = unref($getLocale());
|
|
14
14
|
const routeName = (route.name ?? "").toString();
|
|
@@ -290,7 +290,10 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
290
290
|
return i18nRouteParams.value;
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
|
-
provideData
|
|
293
|
+
const $provideData = Object.fromEntries(
|
|
294
|
+
Object.entries(provideData).map(([key, value]) => [`$${key}`, value])
|
|
295
|
+
);
|
|
296
|
+
provideData.i18n = { ...provideData, ...$provideData };
|
|
294
297
|
return {
|
|
295
298
|
provide: provideData
|
|
296
299
|
};
|
|
@@ -53,8 +53,8 @@ export default defineNuxtPlugin(async (_nuxtApp) => {
|
|
|
53
53
|
if (Object.values(normalizedLocales).length) {
|
|
54
54
|
if (normalizedLocales[currentLocale]) {
|
|
55
55
|
const translation = normalizedLocales[currentLocale];
|
|
56
|
-
const
|
|
57
|
-
|
|
56
|
+
const { $mergeTranslations } = useNuxtApp().$i18n;
|
|
57
|
+
$mergeTranslations(translation);
|
|
58
58
|
}
|
|
59
59
|
if (!normalizedLocales[currentLocale]) {
|
|
60
60
|
let defaultRouteName = route.name?.toString().replace("localized-", "").replace(new RegExp(`-${currentLocale}$`), "");
|
package/dist/types.d.mts
CHANGED
|
@@ -4,4 +4,4 @@ declare module '@nuxt/schema' {
|
|
|
4
4
|
interface NuxtHooks extends ModuleHooks {}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export { type
|
|
7
|
+
export { type PluginsInjections } from './module.js'
|
package/dist/types.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ declare module '@nuxt/schema' {
|
|
|
4
4
|
interface NuxtHooks extends ModuleHooks {}
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export { type
|
|
7
|
+
export { type PluginsInjections } from './module'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.2",
|
|
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",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"client:build": "nuxi generate client",
|
|
54
54
|
"client:dev": "nuxi dev client --port 3300",
|
|
55
55
|
"typecheck": "tsc --noEmit",
|
|
56
|
+
"typecheck:nuxt": "nuxt typecheck --no-emit",
|
|
56
57
|
"docs:dev": "vitepress dev docs",
|
|
57
58
|
"docs:build": "vitepress build docs",
|
|
58
59
|
"docs:serve": "vitepress serve docs",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"586a38c7-df12-4fac-ae0d-f67dd0448804","timestamp":1729326546192,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|