nuxt-i18n-micro 1.15.4 → 1.16.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 +6 -6
- package/dist/client/404.html +6 -6
- package/dist/client/_nuxt/{CtWyte3o.js → BraUkLq2.js} +1 -1
- package/dist/client/_nuxt/CCUdfIr-.js +119 -0
- package/dist/client/_nuxt/{C-3exr1n.js → CLjGsY26.js} +1 -1
- package/dist/client/_nuxt/{C1JBbjFJ.js → CUbs-yQQ.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/613b2437-64f2-42a2-8c2d-9c1b0007ae86.json +1 -0
- package/dist/client/index.html +6 -6
- package/dist/module.d.mts +2 -1
- package/dist/module.d.ts +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +14 -9
- package/dist/runtime/components/i18n-t.vue +7 -6
- package/dist/runtime/components/i18n-t.vue.d.ts +23 -19
- package/dist/runtime/plugins/01.plugin.js +2 -2
- package/package.json +1 -1
- package/dist/client/_nuxt/DLyXNYo2.js +0 -119
- package/dist/client/_nuxt/builds/meta/3a47c997-53fe-4d2e-b6ee-2d642c8aae98.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"./CCUdfIr-.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 s,o as i,c as u,a as t,t as o,b as l,w as c,d,e as p}from"./
|
|
1
|
+
import{_ as s,o as i,c as u,a as t,t as o,b as l,w as c,d,e as p}from"./CCUdfIr-.js";import{u as f}from"./CLjGsY26.js";const g={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},b={class:"max-w-520px text-center z-20"},h=["textContent"],x=["textContent"],m={class:"w-full flex items-center justify-center"},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(e){const n=e;return f({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}a{color:inherit;text-decoration: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: }'}]}),(k,r)=>{const a=p;return i(),u("div",g,[r[0]||(r[0]=t("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),t("div",b,[t("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:o(e.statusCode)},null,8,h),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,x),t("div",m,[l(a,{to:"/",class:"gradient-border text-md sm:text-xl py-2 px-4 sm:py-3 sm:px-6 cursor-pointer"},{default:c(()=>[d(o(e.backHome),1)]),_:1})])])])}}},z=s(y,[["__scopeId","data-v-83de2354"]]);export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"613b2437-64f2-42a2-8c2d-9c1b0007ae86","timestamp":1726489011724}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"613b2437-64f2-42a2-8c2d-9c1b0007ae86","timestamp":1726489011724,"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/CCUdfIr-.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/CUbs-yQQ.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CLjGsY26.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/BraUkLq2.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/CCUdfIr-.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:"613b2437-64f2-42a2-8c2d-9c1b0007ae86",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -7,7 +7,8 @@ interface Locale {
|
|
|
7
7
|
iso?: string;
|
|
8
8
|
dir?: 'ltr' | 'rtl' | 'auto';
|
|
9
9
|
}
|
|
10
|
-
type
|
|
10
|
+
type Getter = (key: string, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown;
|
|
11
|
+
type PluralFunc = (key: string, count: number, locale: string, getter: Getter) => string | null;
|
|
11
12
|
interface ModuleOptions {
|
|
12
13
|
locales?: Locale[];
|
|
13
14
|
meta?: boolean;
|
package/dist/module.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ interface Locale {
|
|
|
7
7
|
iso?: string;
|
|
8
8
|
dir?: 'ltr' | 'rtl' | 'auto';
|
|
9
9
|
}
|
|
10
|
-
type
|
|
10
|
+
type Getter = (key: string, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown;
|
|
11
|
+
type PluralFunc = (key: string, count: number, locale: string, getter: Getter) => string | null;
|
|
11
12
|
interface ModuleOptions {
|
|
12
13
|
locales?: Locale[];
|
|
13
14
|
meta?: boolean;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { useNuxt, defineNuxtModule, createResolver, addPlugin, addImportsDir, addServerHandler, addComponentsDir, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
2
|
+
import { useNuxt, defineNuxtModule, useLogger, createResolver, addPlugin, addImportsDir, addServerHandler, addComponentsDir, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
3
3
|
import { watch } from 'chokidar';
|
|
4
4
|
import * as fs from 'node:fs';
|
|
5
5
|
import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
@@ -350,18 +350,23 @@ const module = defineNuxtModule({
|
|
|
350
350
|
fallbackLocale: void 0,
|
|
351
351
|
localeCookie: "user-locale",
|
|
352
352
|
routesLocaleLinks: {},
|
|
353
|
-
plural:
|
|
354
|
-
const
|
|
353
|
+
plural: (key, count, _locale, getTranslation) => {
|
|
354
|
+
const translation = getTranslation(key, {});
|
|
355
|
+
if (!translation) {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
const forms = translation.toString().split("|");
|
|
355
359
|
if (count === 0 && forms.length > 2) {
|
|
356
|
-
return forms[0].trim()
|
|
360
|
+
return forms[0].trim();
|
|
357
361
|
}
|
|
358
362
|
if (count === 1 && forms.length > 1) {
|
|
359
|
-
return forms[1].trim()
|
|
363
|
+
return forms[1].trim();
|
|
360
364
|
}
|
|
361
|
-
return (forms.length > 2 ? forms[2].trim() : forms[forms.length - 1].trim()).replace(
|
|
362
|
-
}
|
|
365
|
+
return (forms.length > 2 ? forms[2].trim() : forms[forms.length - 1].trim()).replace("{count}", count.toString());
|
|
366
|
+
}
|
|
363
367
|
},
|
|
364
368
|
async setup(options, nuxt) {
|
|
369
|
+
const logger = useLogger("nuxt-i18n-micro");
|
|
365
370
|
const resolver = createResolver(import.meta.url);
|
|
366
371
|
const rootDirs = nuxt.options._layers.map((layer) => layer.config.rootDir).reverse();
|
|
367
372
|
const localeManager = new LocaleManager(options, rootDirs);
|
|
@@ -464,10 +469,10 @@ const module = defineNuxtModule({
|
|
|
464
469
|
const isProd = nuxt.options.dev === false;
|
|
465
470
|
if (!isProd) {
|
|
466
471
|
const translationPath = path.resolve(nuxt.options.rootDir, options.translationDir);
|
|
467
|
-
|
|
472
|
+
logger.log("\u2139 add file watcher: " + translationPath);
|
|
468
473
|
const watcherEvent = async (path2) => {
|
|
469
474
|
watcher.close();
|
|
470
|
-
|
|
475
|
+
logger.log("\u21BB update store item: " + path2);
|
|
471
476
|
nuxt.callHook("restart");
|
|
472
477
|
};
|
|
473
478
|
const watcher = watch(translationPath, { depth: 1, persistent: true }).on("change", watcherEvent);
|
|
@@ -41,13 +41,14 @@ export default defineComponent({
|
|
|
41
41
|
const options = {};
|
|
42
42
|
if (props.plural !== void 0) {
|
|
43
43
|
if (props.customPluralRule) {
|
|
44
|
-
return props.customPluralRule(
|
|
45
|
-
|
|
46
|
-
props.plural,
|
|
47
|
-
useNuxtApp().$getLocale()
|
|
48
|
-
|
|
44
|
+
return h(props.tag, { ...attrs, innerHTML: props.customPluralRule(
|
|
45
|
+
props.keypath,
|
|
46
|
+
Number.parseInt(props.plural.toString()),
|
|
47
|
+
useNuxtApp().$getLocale(),
|
|
48
|
+
useNuxtApp().$t
|
|
49
|
+
) });
|
|
49
50
|
} else {
|
|
50
|
-
return useNuxtApp().$tc(props.keypath, Number.parseInt(props.plural.toString()));
|
|
51
|
+
return h(props.tag, { ...attrs, innerHTML: useNuxtApp().$tc(props.keypath, Number.parseInt(props.plural.toString())) });
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
const translation = (useNuxtApp().$t(props.keypath, { ...props.params, ...options }) ?? "").toString();
|
|
@@ -1,73 +1,77 @@
|
|
|
1
|
+
import type { VNode, PropType } from 'vue';
|
|
2
|
+
import type { PluralFunc } from '../../types.js';
|
|
1
3
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
4
|
keypath: {
|
|
3
|
-
type:
|
|
5
|
+
type: PropType<string>;
|
|
4
6
|
required: true;
|
|
5
7
|
};
|
|
6
8
|
plural: {
|
|
7
|
-
type:
|
|
9
|
+
type: PropType<number | string>;
|
|
8
10
|
};
|
|
9
11
|
tag: {
|
|
10
|
-
type:
|
|
12
|
+
type: PropType<string>;
|
|
11
13
|
default: string;
|
|
12
14
|
};
|
|
13
15
|
params: {
|
|
14
|
-
type:
|
|
16
|
+
type: PropType<Record<string, string | number | boolean>>;
|
|
15
17
|
default: () => {};
|
|
16
18
|
};
|
|
17
19
|
defaultValue: {
|
|
18
|
-
type:
|
|
20
|
+
type: PropType<string>;
|
|
19
21
|
default: string;
|
|
20
22
|
};
|
|
21
23
|
html: {
|
|
22
|
-
type:
|
|
24
|
+
type: PropType<boolean>;
|
|
23
25
|
default: boolean;
|
|
24
26
|
};
|
|
25
27
|
hideIfEmpty: {
|
|
26
|
-
type:
|
|
28
|
+
type: PropType<boolean>;
|
|
27
29
|
default: boolean;
|
|
28
30
|
};
|
|
29
31
|
customPluralRule: {
|
|
30
|
-
type:
|
|
32
|
+
type: PropType<PluralFunc>;
|
|
31
33
|
default: null;
|
|
32
34
|
};
|
|
33
|
-
}>, () =>
|
|
35
|
+
}>, () => string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
38
|
keypath: {
|
|
35
|
-
type:
|
|
39
|
+
type: PropType<string>;
|
|
36
40
|
required: true;
|
|
37
41
|
};
|
|
38
42
|
plural: {
|
|
39
|
-
type:
|
|
43
|
+
type: PropType<number | string>;
|
|
40
44
|
};
|
|
41
45
|
tag: {
|
|
42
|
-
type:
|
|
46
|
+
type: PropType<string>;
|
|
43
47
|
default: string;
|
|
44
48
|
};
|
|
45
49
|
params: {
|
|
46
|
-
type:
|
|
50
|
+
type: PropType<Record<string, string | number | boolean>>;
|
|
47
51
|
default: () => {};
|
|
48
52
|
};
|
|
49
53
|
defaultValue: {
|
|
50
|
-
type:
|
|
54
|
+
type: PropType<string>;
|
|
51
55
|
default: string;
|
|
52
56
|
};
|
|
53
57
|
html: {
|
|
54
|
-
type:
|
|
58
|
+
type: PropType<boolean>;
|
|
55
59
|
default: boolean;
|
|
56
60
|
};
|
|
57
61
|
hideIfEmpty: {
|
|
58
|
-
type:
|
|
62
|
+
type: PropType<boolean>;
|
|
59
63
|
default: boolean;
|
|
60
64
|
};
|
|
61
65
|
customPluralRule: {
|
|
62
|
-
type:
|
|
66
|
+
type: PropType<PluralFunc>;
|
|
63
67
|
default: null;
|
|
64
68
|
};
|
|
65
69
|
}>> & Readonly<{}>, {
|
|
66
70
|
tag: string;
|
|
67
|
-
params: Record<string,
|
|
71
|
+
params: Record<string, string | number | boolean>;
|
|
68
72
|
defaultValue: string;
|
|
69
73
|
html: boolean;
|
|
70
74
|
hideIfEmpty: boolean;
|
|
71
|
-
customPluralRule:
|
|
75
|
+
customPluralRule: PluralFunc;
|
|
72
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
73
77
|
export default _default;
|
|
@@ -132,8 +132,8 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
132
132
|
},
|
|
133
133
|
t: getTranslation,
|
|
134
134
|
tc: (key, count, defaultValue) => {
|
|
135
|
-
const
|
|
136
|
-
return plural(
|
|
135
|
+
const currentLocale = getCurrentLocale(useRoute(), i18nConfig);
|
|
136
|
+
return plural(key, count, currentLocale, getTranslation) ?? defaultValue ?? key;
|
|
137
137
|
},
|
|
138
138
|
tn: (value, options) => {
|
|
139
139
|
const locale = getCurrentLocale(useRoute(), i18nConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.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",
|