nuxt-i18n-micro 1.35.1 → 1.36.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/{CBccCxXK.js → B1xCwjDF.js} +1 -1
- package/dist/client/_nuxt/{DNen4El9.js → CzPI1GQJ.js} +1 -1
- package/dist/client/_nuxt/{Ltm7XuUs.js → DsNZE4Dc.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/166e9332-75a4-41da-96ec-b2e17e8c07d9.json +1 -0
- package/dist/client/_nuxt/fYVA_EiS.js +3822 -0
- package/dist/client/index.html +6 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +8 -8
- package/dist/runtime/translation-server-middleware.js +2 -3
- package/internals.d.ts +1 -1
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/e0ff356c-21be-41f8-ae56-03da9bfbdd59.json +0 -1
- package/dist/client/_nuxt/n4MbYZHF.js +0 -3822
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.BWujgj23.css" crossorigin>
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/fYVA_EiS.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.SWzu_puR.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/DsNZE4Dc.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/B1xCwjDF.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.Bkv_zTjr.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/CzPI1GQJ.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/fYVA_EiS.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},1733171890220,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"166e9332-75a4-41da-96ec-b2e17e8c07d9",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import fs__default, { readFileSync, existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
4
|
import { useNuxt, defineNuxtModule, useLogger, createResolver, addTemplate, addPlugin, addImportsDir, addServerHandler, addComponentsDir, addTypeTemplate, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
6
5
|
import { watch } from 'chokidar';
|
|
7
6
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
@@ -452,12 +451,9 @@ const module = defineNuxtModule({
|
|
|
452
451
|
addTemplate({
|
|
453
452
|
filename: "i18n.plural.mjs",
|
|
454
453
|
write: true,
|
|
455
|
-
getContents: () => `
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
filename: "i18n.config.mjs",
|
|
459
|
-
write: true,
|
|
460
|
-
getContents: () => `export const defaultLocale = "${options.defaultLocale}";`
|
|
454
|
+
getContents: () => `
|
|
455
|
+
export const plural = ${options.plural.toString()};
|
|
456
|
+
`
|
|
461
457
|
});
|
|
462
458
|
const apiBaseUrl = (process.env.NUXT_I18N_APP_BASE_URL ?? options.apiBaseUrl ?? "_locales").replace(/^\/+|\/+$|\/{2,}/, "");
|
|
463
459
|
nuxt.options.runtimeConfig.public.i18nConfig = {
|
|
@@ -598,10 +594,14 @@ const module = defineNuxtModule({
|
|
|
598
594
|
if (nitroConfig.imports) {
|
|
599
595
|
nitroConfig.imports.presets = nitroConfig.imports.presets || [];
|
|
600
596
|
nitroConfig.imports.presets.push({
|
|
601
|
-
from:
|
|
597
|
+
from: resolver.resolve("./runtime/translation-server-middleware"),
|
|
602
598
|
imports: ["useTranslationServerMiddleware"]
|
|
603
599
|
});
|
|
604
600
|
}
|
|
601
|
+
nitroConfig.virtual = nitroConfig.virtual || {};
|
|
602
|
+
nitroConfig.virtual["#internal/i18n/options.mjs"] = () => `
|
|
603
|
+
export const defaultLocale = "${options.defaultLocale}";
|
|
604
|
+
`;
|
|
605
605
|
const routes = nitroConfig.prerender?.routes || [];
|
|
606
606
|
nuxt.options.generate.routes = Array.isArray(nuxt.options.generate.routes) ? nuxt.options.generate.routes : [];
|
|
607
607
|
const pages = nuxt.options.generate.routes || [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getQuery, getCookie } from "h3";
|
|
2
2
|
import { useTranslationHelper } from "./translationHelper.js";
|
|
3
|
-
import {
|
|
3
|
+
import { defaultLocale } from "#internal/i18n/options.mjs";
|
|
4
4
|
async function fetchTranslations(locale) {
|
|
5
5
|
try {
|
|
6
6
|
const translations = await $fetch(`/_locales/general/${locale}/data.json`);
|
|
@@ -12,8 +12,7 @@ async function fetchTranslations(locale) {
|
|
|
12
12
|
}
|
|
13
13
|
export const useTranslationServerMiddleware = async (event, currentLocale) => {
|
|
14
14
|
const { getTranslation, loadTranslations, hasGeneralTranslation } = useTranslationHelper();
|
|
15
|
-
const
|
|
16
|
-
const locale = (currentLocale || event.context.params?.locale || getQuery(event)?.locale || getCookie(event, "user-locale") || event.headers.get("accept-language")?.split(",")[0] || runtimeI18n.defaultLocale || "en").toString();
|
|
15
|
+
const locale = (currentLocale || event.context.params?.locale || getQuery(event)?.locale || getCookie(event, "user-locale") || event.headers.get("accept-language")?.split(",")[0] || defaultLocale || "en").toString();
|
|
17
16
|
if (!hasGeneralTranslation(locale)) {
|
|
18
17
|
const translations = await fetchTranslations(locale);
|
|
19
18
|
await loadTranslations(locale, translations);
|
package/internals.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.36.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",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"e0ff356c-21be-41f8-ae56-03da9bfbdd59","timestamp":1733170108539,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|