nuxt-i18n-micro 2.4.0 → 2.5.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 +2 -2
- package/dist/client/404.html +2 -2
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/dc8ec25f-2f2b-41cd-9ff1-ce2de81f36ea.json +1 -0
- package/dist/client/index.html +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -4
- package/dist/runtime/plugins/01.plugin.js +2 -2
- package/dist/runtime/translation-server-middleware.js +3 -1
- package/package.json +1 -1
- package/dist/client/_nuxt/builds/meta/2d4fb144-8539-4f7d-a7d3-5dedb810c640.json +0 -1
package/dist/client/200.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CBxwnKtU.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.BqKd8Zt-.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BYEpoBUk.js">
|
|
11
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/XZXfxmri.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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
11
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/XZXfxmri.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},1762356606888,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"dc8ec25f-2f2b-41cd-9ff1-ce2de81f36ea",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/client/404.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CBxwnKtU.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.BqKd8Zt-.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BYEpoBUk.js">
|
|
11
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/XZXfxmri.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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
11
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/XZXfxmri.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},1762356606889,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"dc8ec25f-2f2b-41cd-9ff1-ce2de81f36ea",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"dc8ec25f-2f2b-41cd-9ff1-ce2de81f36ea","timestamp":1762356596622}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"dc8ec25f-2f2b-41cd-9ff1-ce2de81f36ea","timestamp":1762356596622,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|
package/dist/client/index.html
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CBxwnKtU.js">
|
|
9
9
|
<link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.BqKd8Zt-.css">
|
|
10
10
|
<link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BYEpoBUk.js">
|
|
11
|
-
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/XZXfxmri.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},
|
|
12
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"
|
|
11
|
+
<script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/XZXfxmri.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},1762356606889,false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"dc8ec25f-2f2b-41cd-9ff1-ce2de81f36ea",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -895,7 +895,8 @@ const module = defineNuxtModule({
|
|
|
895
895
|
write: true,
|
|
896
896
|
getContents: () => `export const plural = ${options.plural.toString()};`
|
|
897
897
|
});
|
|
898
|
-
const
|
|
898
|
+
const rawUrl = process.env.NUXT_I18N_APP_BASE_URL ?? options.apiBaseUrl ?? "_locales";
|
|
899
|
+
const apiBaseUrl = rawUrl.startsWith("http://") || rawUrl.startsWith("https://") ? rawUrl : "/" + rawUrl.replace(/^\/+|\/+$|\/{2,}/, "");
|
|
899
900
|
nuxt.options.runtimeConfig.public.i18nConfig = {
|
|
900
901
|
locales: localeManager.locales ?? [],
|
|
901
902
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -997,7 +998,7 @@ const module = defineNuxtModule({
|
|
|
997
998
|
});
|
|
998
999
|
}
|
|
999
1000
|
addServerHandler({
|
|
1000
|
-
route:
|
|
1001
|
+
route: `${apiBaseUrl}/:page/:locale/data.json`,
|
|
1001
1002
|
handler: resolver.resolve("./runtime/server/routes/get")
|
|
1002
1003
|
});
|
|
1003
1004
|
addComponentsDir({
|
|
@@ -1072,10 +1073,10 @@ ${accepts}
|
|
|
1072
1073
|
localeManager.locales.forEach((locale) => {
|
|
1073
1074
|
if (!options.disablePageLocales) {
|
|
1074
1075
|
pagesNames.forEach((name) => {
|
|
1075
|
-
prerenderRoutes.push(
|
|
1076
|
+
prerenderRoutes.push(`${apiBaseUrl}/${name}/${locale.code}/data.json`);
|
|
1076
1077
|
});
|
|
1077
1078
|
}
|
|
1078
|
-
prerenderRoutes.push(
|
|
1079
|
+
prerenderRoutes.push(`${apiBaseUrl}/general/${locale.code}/data.json`);
|
|
1079
1080
|
});
|
|
1080
1081
|
if (!options.disableWatcher) {
|
|
1081
1082
|
localeManager.ensureTranslationFilesExist(pagesNames, options.translationDir, nuxt.options.rootDir);
|
|
@@ -7,7 +7,7 @@ const isDev = process.env.NODE_ENV !== "production";
|
|
|
7
7
|
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
8
8
|
const config = useRuntimeConfig();
|
|
9
9
|
const i18nConfig = config.public.i18nConfig;
|
|
10
|
-
const apiBaseUrl = i18nConfig.apiBaseUrl ?? "_locales";
|
|
10
|
+
const apiBaseUrl = i18nConfig.apiBaseUrl ?? "/_locales";
|
|
11
11
|
const router = useRouter();
|
|
12
12
|
const runtimeConfig = useRuntimeConfig();
|
|
13
13
|
const generalLocaleCache = useState("i18n-general-cache", () => ({}));
|
|
@@ -68,7 +68,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
68
68
|
}
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
const url =
|
|
71
|
+
const url = `${apiBaseUrl}/${routeName}/${locale}/data.json`.replace(/\/{2,}/g, "/");
|
|
72
72
|
try {
|
|
73
73
|
const data = await $fetch(url, {
|
|
74
74
|
baseURL: runtimeConfig.app.baseURL,
|
|
@@ -4,7 +4,9 @@ import { useRuntimeConfig } from "#imports";
|
|
|
4
4
|
const I18N_CONTEXT_KEY = "__i18n_cache__";
|
|
5
5
|
async function fetchTranslations(locale) {
|
|
6
6
|
try {
|
|
7
|
-
const
|
|
7
|
+
const config = useRuntimeConfig();
|
|
8
|
+
const apiBaseUrl = config.public.i18nConfig?.apiBaseUrl ?? "/_locales";
|
|
9
|
+
const translations = await $fetch(`${apiBaseUrl}/general/${locale}/data.json`);
|
|
8
10
|
return translations;
|
|
9
11
|
} catch (error) {
|
|
10
12
|
console.error(`Error loading translation for locale "${locale}":`, error);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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":"2d4fb144-8539-4f7d-a7d3-5dedb810c640","timestamp":1762341830059,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|