nuxt-i18n-micro 1.12.6 → 1.13.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/{3K8wcrOi.js → BpNRGTHy.js} +1 -1
- package/dist/client/_nuxt/D1fvHJQV.js +119 -0
- package/dist/client/_nuxt/{Bb67euK9.js → DxMn4SAe.js} +1 -1
- package/dist/client/_nuxt/{CBnq9Yf3.js → DzdJBprQ.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/5324e7e7-92a1-4e32-b4c3-4ce4f77f2934.json +1 -0
- package/dist/client/index.html +6 -6
- package/dist/module.d.mts +5 -2
- package/dist/module.d.ts +5 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -6
- package/dist/runtime/composables/useI18n.js +1 -0
- package/dist/runtime/plugins/01.plugin.d.ts +4 -1
- package/dist/runtime/plugins/01.plugin.js +5 -0
- package/dist/runtime/server/middleware/i18n-loader.js +2 -1
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/d4fcda60-d5e3-4685-ae1f-cdc4257a8754.json +0 -1
- package/dist/client/_nuxt/m7X1zp9L.js +0 -119
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as o,r as u,g as f,h as d,j as v,k as l,l as i,m as h,n as m}from"./
|
|
1
|
+
import{i as o,r as u,g as f,h as d,j as v,k as l,l as i,m as h,n as m}from"./D1fvHJQV.js";function U(t,a={}){const e=a.head||o();if(e)return e.ssr?e.push(t,a):p(e,t,a)}function p(t,a,e={}){const s=u(!1),n=u({});f(()=>{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 o}from"./
|
|
1
|
+
import{u as o}from"./DxMn4SAe.js";import{_ as a,o as s,c as i,a as e,t as r,p as u,f as l}from"./D1fvHJQV.js";const c=t=>(u("data-v-b63e9691"),t=t(),l(),t),d={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},p=c(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),h={class:"max-w-520px text-center"},b=["textContent"],g=["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 n=t;return o({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: }'}]}),(m,x)=>(s(),i("div",d,[p,e("div",h,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:r(t.statusCode)},null,8,b),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:r(t.description)},null,8,g)])]))}},w=a(f,[["__scopeId","data-v-b63e9691"]]);export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"5324e7e7-92a1-4e32-b4c3-4ce4f77f2934","timestamp":1725449582814}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"5324e7e7-92a1-4e32-b4c3-4ce4f77f2934","timestamp":1725449582814,"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/D1fvHJQV.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/BpNRGTHy.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DxMn4SAe.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/DzdJBprQ.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/D1fvHJQV.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:"5324e7e7-92a1-4e32-b4c3-4ce4f77f2934",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -23,12 +23,14 @@ interface ModuleOptions {
|
|
|
23
23
|
disablePageLocales?: boolean;
|
|
24
24
|
}
|
|
25
25
|
interface ModuleOptionsExtend extends ModuleOptions {
|
|
26
|
-
rootDir: string;
|
|
27
26
|
plural: string;
|
|
28
|
-
rootDirs: string[];
|
|
29
27
|
dateBuild: number;
|
|
30
28
|
baseURL: string;
|
|
31
29
|
}
|
|
30
|
+
interface ModulePrivateOptionsExtend extends ModuleOptions {
|
|
31
|
+
rootDir: string;
|
|
32
|
+
rootDirs: string[];
|
|
33
|
+
}
|
|
32
34
|
|
|
33
35
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
34
36
|
|
|
@@ -37,6 +39,7 @@ interface ModuleHooks {
|
|
|
37
39
|
}
|
|
38
40
|
declare module '@nuxt/schema' {
|
|
39
41
|
interface ConfigSchema {
|
|
42
|
+
i18nConfig?: ModulePrivateOptionsExtend;
|
|
40
43
|
publicRuntimeConfig?: {
|
|
41
44
|
i18nConfig?: ModuleOptionsExtend;
|
|
42
45
|
};
|
package/dist/module.d.ts
CHANGED
|
@@ -23,12 +23,14 @@ interface ModuleOptions {
|
|
|
23
23
|
disablePageLocales?: boolean;
|
|
24
24
|
}
|
|
25
25
|
interface ModuleOptionsExtend extends ModuleOptions {
|
|
26
|
-
rootDir: string;
|
|
27
26
|
plural: string;
|
|
28
|
-
rootDirs: string[];
|
|
29
27
|
dateBuild: number;
|
|
30
28
|
baseURL: string;
|
|
31
29
|
}
|
|
30
|
+
interface ModulePrivateOptionsExtend extends ModuleOptions {
|
|
31
|
+
rootDir: string;
|
|
32
|
+
rootDirs: string[];
|
|
33
|
+
}
|
|
32
34
|
|
|
33
35
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
34
36
|
|
|
@@ -37,6 +39,7 @@ interface ModuleHooks {
|
|
|
37
39
|
}
|
|
38
40
|
declare module '@nuxt/schema' {
|
|
39
41
|
interface ConfigSchema {
|
|
42
|
+
i18nConfig?: ModulePrivateOptionsExtend;
|
|
40
43
|
publicRuntimeConfig?: {
|
|
41
44
|
i18nConfig?: ModuleOptionsExtend;
|
|
42
45
|
};
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -39,7 +39,7 @@ function setupDevToolsUI(options, resolve) {
|
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
async getLocalesAndTranslations() {
|
|
42
|
-
const rootDirs = nuxt.options.runtimeConfig.
|
|
42
|
+
const rootDirs = nuxt.options.runtimeConfig.i18nConfig?.rootDirs || [nuxt.options.rootDir];
|
|
43
43
|
const localesData = [];
|
|
44
44
|
for (const rootDir of rootDirs) {
|
|
45
45
|
const localesDir = path.join(rootDir, options.translationDir || "locales");
|
|
@@ -156,7 +156,7 @@ class PageManager {
|
|
|
156
156
|
findDefaultLocale(defaultLocaleCode) {
|
|
157
157
|
return this.locales.find((locale) => locale.code === defaultLocaleCode) || { code: defaultLocaleCode };
|
|
158
158
|
}
|
|
159
|
-
extendPages(pages,
|
|
159
|
+
extendPages(pages, rootDir) {
|
|
160
160
|
this.localizedPaths = this.extractLocalizedPaths(pages, rootDir);
|
|
161
161
|
const additionalRoutes = [];
|
|
162
162
|
pages.forEach((page) => this.localizePage(page, additionalRoutes));
|
|
@@ -365,8 +365,6 @@ const module = defineNuxtModule({
|
|
|
365
365
|
const localeManager = new LocaleManager(options, rootDirs);
|
|
366
366
|
const pageManager = new PageManager(localeManager.locales, options.defaultLocale, options.includeDefaultLocaleRoute);
|
|
367
367
|
nuxt.options.runtimeConfig.public.i18nConfig = {
|
|
368
|
-
rootDir: nuxt.options.rootDir,
|
|
369
|
-
rootDirs,
|
|
370
368
|
plural: options.plural,
|
|
371
369
|
locales: localeManager.locales ?? [],
|
|
372
370
|
meta: options.meta ?? true,
|
|
@@ -382,6 +380,10 @@ const module = defineNuxtModule({
|
|
|
382
380
|
dateBuild: Date.now(),
|
|
383
381
|
baseURL: nuxt.options.app.baseURL
|
|
384
382
|
};
|
|
383
|
+
nuxt.options.runtimeConfig.i18nConfig = {
|
|
384
|
+
rootDir: nuxt.options.rootDir,
|
|
385
|
+
rootDirs
|
|
386
|
+
};
|
|
385
387
|
addPlugin({
|
|
386
388
|
src: resolver.resolve("./runtime/plugins/01.plugin"),
|
|
387
389
|
order: 1
|
|
@@ -426,7 +428,7 @@ const module = defineNuxtModule({
|
|
|
426
428
|
if (!options.disableWatcher) {
|
|
427
429
|
localeManager.ensureTranslationFilesExist(pagesNames, options.translationDir, nuxt.options.rootDir);
|
|
428
430
|
}
|
|
429
|
-
pageManager.extendPages(pages,
|
|
431
|
+
pageManager.extendPages(pages, nuxt.options.rootDir);
|
|
430
432
|
nuxt.options.generate.routes = Array.isArray(nuxt.options.generate.routes) ? nuxt.options.generate.routes : [];
|
|
431
433
|
localeManager.locales.forEach((locale) => {
|
|
432
434
|
if (!options.disablePageLocales) {
|
|
@@ -471,7 +473,7 @@ const module = defineNuxtModule({
|
|
|
471
473
|
const routesSet = prerenderRoutes.routes;
|
|
472
474
|
const additionalRoutes = /* @__PURE__ */ new Set();
|
|
473
475
|
routesSet.forEach((route) => {
|
|
474
|
-
|
|
476
|
+
localeManager.locales.forEach((locale) => {
|
|
475
477
|
if (locale.code !== options.defaultLocale) {
|
|
476
478
|
if (route === "/") {
|
|
477
479
|
additionalRoutes.add(`/${locale.code}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RouteLocationRaw } from 'vue-router';
|
|
1
|
+
import type { RouteLocationNormalizedLoaded, RouteLocationRaw, RouteLocationResolvedGeneric } from 'vue-router';
|
|
2
2
|
import type { Locale } from '../../types.js';
|
|
3
3
|
export interface Translations {
|
|
4
4
|
[key: string]: string | number | boolean | Translations | PluralTranslations | unknown[] | null;
|
|
@@ -10,6 +10,7 @@ interface PluralTranslations {
|
|
|
10
10
|
declare const _default: import("#app").Plugin<{
|
|
11
11
|
getLocale: () => string;
|
|
12
12
|
getLocales: () => Locale[];
|
|
13
|
+
getRouteName: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric, locale?: string) => string;
|
|
13
14
|
t: (key: string, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown;
|
|
14
15
|
tc: (key: string, count: number, defaultValue?: string) => string;
|
|
15
16
|
tn: (value: number, options?: Intl.NumberFormatOptions) => string;
|
|
@@ -21,6 +22,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
21
22
|
}> & import("#app").ObjectPlugin<{
|
|
22
23
|
getLocale: () => string;
|
|
23
24
|
getLocales: () => Locale[];
|
|
25
|
+
getRouteName: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric, locale?: string) => string;
|
|
24
26
|
t: (key: string, params?: Record<string, string | number | boolean>, defaultValue?: string) => unknown;
|
|
25
27
|
tc: (key: string, count: number, defaultValue?: string) => string;
|
|
26
28
|
tn: (value: number, options?: Intl.NumberFormatOptions) => string;
|
|
@@ -34,6 +36,7 @@ export default _default;
|
|
|
34
36
|
export interface PluginsInjections {
|
|
35
37
|
$getLocale: () => string;
|
|
36
38
|
$getLocales: () => Locale[];
|
|
39
|
+
$getRouteName: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric, locale?: string) => string;
|
|
37
40
|
$t: <T extends Record<string, string | number | boolean>>(key: string, params?: T, defaultValue?: string) => string | number | boolean | Translations | PluralTranslations | unknown[] | unknown | null;
|
|
38
41
|
$tc: (key: string, count: number, defaultValue?: string) => string;
|
|
39
42
|
$tn: (value: number, options?: Intl.NumberFormatOptions) => string;
|
|
@@ -123,6 +123,11 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
123
123
|
provide: {
|
|
124
124
|
getLocale: () => getCurrentLocale(useRoute(), i18nConfig),
|
|
125
125
|
getLocales: () => i18nConfig.locales || [],
|
|
126
|
+
getRouteName: (route2, locale) => {
|
|
127
|
+
const selectedLocale = locale ?? getCurrentLocale(useRoute(), i18nConfig);
|
|
128
|
+
const selectedRoute = route2 ?? useRoute();
|
|
129
|
+
return getRouteName(selectedRoute, selectedLocale);
|
|
130
|
+
},
|
|
126
131
|
t: getTranslation,
|
|
127
132
|
tc: (key, count, defaultValue) => {
|
|
128
133
|
const translation = getTranslation(key, {}, defaultValue);
|
|
@@ -5,7 +5,8 @@ import { useRuntimeConfig } from "#imports";
|
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
const { page, locale } = event.context.params;
|
|
7
7
|
const config = useRuntimeConfig();
|
|
8
|
-
const { rootDirs
|
|
8
|
+
const { rootDirs } = config.i18nConfig;
|
|
9
|
+
const { translationDir } = config.public.i18nConfig;
|
|
9
10
|
let path = `${locale}.json`;
|
|
10
11
|
if (page !== "general") {
|
|
11
12
|
path = `pages/${page}/${locale}.json`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.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":"d4fcda60-d5e3-4685-ae1f-cdc4257a8754","timestamp":1725445689983,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|