nuxt-i18n-micro 1.15.2 → 1.15.4
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/{7ndIm6o9.js → C-3exr1n.js} +1 -1
- package/dist/client/_nuxt/{C7n54VlH.js → C1JBbjFJ.js} +1 -1
- package/dist/client/_nuxt/{CfFALiM5.js → CtWyte3o.js} +1 -1
- package/dist/client/_nuxt/DLyXNYo2.js +119 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/3a47c997-53fe-4d2e-b6ee-2d642c8aae98.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 +4 -1
- package/dist/runtime/plugins/01.plugin.js +1 -1
- package/dist/runtime/server/middleware/i18n-loader.js +6 -1
- package/package.json +1 -1
- package/dist/client/_nuxt/CynvVaH0.js +0 -119
- package/dist/client/_nuxt/builds/meta/24680bcd-5d41-4cea-91e3-8b4de3051e5a.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"3a47c997-53fe-4d2e-b6ee-2d642c8aae98","timestamp":1726291818338}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"3a47c997-53fe-4d2e-b6ee-2d642c8aae98","timestamp":1726291818338,"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/DLyXNYo2.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/C1JBbjFJ.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/C-3exr1n.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/CtWyte3o.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/DLyXNYo2.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:"3a47c997-53fe-4d2e-b6ee-2d642c8aae98",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -7,6 +7,7 @@ interface Locale {
|
|
|
7
7
|
iso?: string;
|
|
8
8
|
dir?: 'ltr' | 'rtl' | 'auto';
|
|
9
9
|
}
|
|
10
|
+
type PluralFunc = (translation: unknown, count: number, locale: string) => string;
|
|
10
11
|
interface ModuleOptions {
|
|
11
12
|
locales?: Locale[];
|
|
12
13
|
meta?: boolean;
|
|
@@ -19,7 +20,7 @@ interface ModuleOptions {
|
|
|
19
20
|
disableWatcher?: boolean;
|
|
20
21
|
includeDefaultLocaleRoute?: boolean;
|
|
21
22
|
routesLocaleLinks?: Record<string, string>;
|
|
22
|
-
plural?: string;
|
|
23
|
+
plural?: string | PluralFunc;
|
|
23
24
|
disablePageLocales?: boolean;
|
|
24
25
|
fallbackLocale?: string;
|
|
25
26
|
localeCookie?: string;
|
package/dist/module.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface Locale {
|
|
|
7
7
|
iso?: string;
|
|
8
8
|
dir?: 'ltr' | 'rtl' | 'auto';
|
|
9
9
|
}
|
|
10
|
+
type PluralFunc = (translation: unknown, count: number, locale: string) => string;
|
|
10
11
|
interface ModuleOptions {
|
|
11
12
|
locales?: Locale[];
|
|
12
13
|
meta?: boolean;
|
|
@@ -19,7 +20,7 @@ interface ModuleOptions {
|
|
|
19
20
|
disableWatcher?: boolean;
|
|
20
21
|
includeDefaultLocaleRoute?: boolean;
|
|
21
22
|
routesLocaleLinks?: Record<string, string>;
|
|
22
|
-
plural?: string;
|
|
23
|
+
plural?: string | PluralFunc;
|
|
23
24
|
disablePageLocales?: boolean;
|
|
24
25
|
fallbackLocale?: string;
|
|
25
26
|
localeCookie?: string;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -366,8 +366,11 @@ const module = defineNuxtModule({
|
|
|
366
366
|
const rootDirs = nuxt.options._layers.map((layer) => layer.config.rootDir).reverse();
|
|
367
367
|
const localeManager = new LocaleManager(options, rootDirs);
|
|
368
368
|
const pageManager = new PageManager(localeManager.locales, options.defaultLocale, options.includeDefaultLocaleRoute);
|
|
369
|
+
let plural = options.plural;
|
|
370
|
+
if (typeof plural !== "string")
|
|
371
|
+
plural = plural.toString();
|
|
369
372
|
nuxt.options.runtimeConfig.public.i18nConfig = {
|
|
370
|
-
plural
|
|
373
|
+
plural,
|
|
371
374
|
locales: localeManager.locales ?? [],
|
|
372
375
|
meta: options.meta ?? true,
|
|
373
376
|
metaBaseUrl: options.metaBaseUrl ?? void 0,
|
|
@@ -81,7 +81,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
81
81
|
}
|
|
82
82
|
const config = useRuntimeConfig();
|
|
83
83
|
const i18nConfig = config.public.i18nConfig;
|
|
84
|
-
const plural = new Function("return " + i18nConfig.plural)();
|
|
84
|
+
const plural = new Function("return " + i18nConfig.plural.toString())();
|
|
85
85
|
const loadTranslationsIfNeeded = async (locale, routeName) => {
|
|
86
86
|
if (!i18nHelper.hasPageTranslation(locale, routeName)) {
|
|
87
87
|
let fRouteName = routeName;
|
|
@@ -4,7 +4,12 @@ import { defineEventHandler } from "h3";
|
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
5
|
function deepMerge(target, source) {
|
|
6
6
|
for (const key of Object.keys(source)) {
|
|
7
|
-
if (
|
|
7
|
+
if (key === "__proto__" || key === "constructor") {
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
if (Array.isArray(source[key])) {
|
|
11
|
+
target[key] = source[key];
|
|
12
|
+
} else if (source[key] instanceof Object && key in target) {
|
|
8
13
|
Object.assign(source[key], deepMerge(target[key], source[key]));
|
|
9
14
|
}
|
|
10
15
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.4",
|
|
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",
|