nuxt-i18n-micro 1.94.0 → 1.96.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.
@@ -1,12 +1,12 @@
1
1
  <!DOCTYPE html><html><head><meta charset="utf-8">
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1">
3
- <link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.BVfqTszp.css" crossorigin>
4
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BghP2wsD.js">
3
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.wlACWN2Y.css" crossorigin>
4
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/ivw-WKkv.js">
5
5
  <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/l5rcX3cq.js">
6
- <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CdQyF-WE.css">
7
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BjB9nc_5.js">
8
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BhtDXNyb.js">
9
- <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.CDURyqPT.css">
10
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DpQNspb6.js">
11
- <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BghP2wsD.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},1756402812649,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"bd644dea-2454-468d-ba61-8e09f211303a",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
6
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.B2VbLYbY.css">
7
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DefIAjUZ.js">
8
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BrUpQP6I.js">
9
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DGwSTbEi.css">
10
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C0zq22yw.js">
11
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/ivw-WKkv.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},1758176687705,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"2bd7945f-6cbd-45d4-9b72-30c2c2aeb875",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
3
  "configKey": "i18n",
4
- "version": "1.94.0",
4
+ "version": "1.96.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -582,7 +582,7 @@ const module = defineNuxtModule({
582
582
  },
583
583
  async setup(options, nuxt) {
584
584
  const defaultLocale = process.env.DEFAULT_LOCALE ?? options.defaultLocale ?? "en";
585
- const isSSG = nuxt.options.nitro.static ?? nuxt.options._generate;
585
+ const isSSG = nuxt.options.nitro.static ?? nuxt.options._generate ?? false;
586
586
  const isCloudflarePages = nuxt.options.nitro.preset?.startsWith("cloudflare");
587
587
  const logger = useLogger("nuxt-i18n-micro");
588
588
  if (options.includeDefaultLocaleRoute !== void 0) {
@@ -730,9 +730,6 @@ const module = defineNuxtModule({
730
730
  pages.push(fallbackRoute);
731
731
  }
732
732
  if (!isNoPrefixStrategy(options.strategy)) {
733
- const nuxtOptions = nuxt.options;
734
- nuxtOptions.generate = nuxtOptions.generate || {};
735
- nuxtOptions.generate.routes = Array.isArray(nuxtOptions.generate.routes) ? nuxtOptions.generate.routes : [];
736
733
  if (isCloudflarePages) {
737
734
  const processPageWithChildren = (page, parentPath = "") => {
738
735
  if (!page.path) return;
@@ -823,15 +820,14 @@ const module = defineNuxtModule({
823
820
  return;
824
821
  }
825
822
  const routes = nitroConfig.prerender?.routes || [];
826
- const nuxtOptions = nuxt.options;
827
- nuxtOptions.generate = nuxtOptions.generate || {};
828
- nuxtOptions.generate.routes = Array.isArray(nuxtOptions.generate.routes) ? nuxtOptions.generate.routes : [];
829
- const pages = nuxtOptions.generate.routes || [];
823
+ nitroConfig.prerender = nitroConfig.prerender || {};
824
+ nitroConfig.prerender.routes = Array.isArray(nitroConfig.prerender.routes) ? nitroConfig.prerender.routes : [];
825
+ const pages = nitroConfig.prerender.routes || [];
830
826
  localeManager.locales.forEach((locale) => {
831
827
  const shouldGenerate = locale.code !== defaultLocale || withPrefixStrategy(options.strategy);
832
828
  if (shouldGenerate) {
833
829
  pages.forEach((page) => {
834
- if (!/\.[a-z0-9]+$/i.test(page) && !isInternalPath(page)) {
830
+ if (page && !/\.[a-z0-9]+$/i.test(page) && !isInternalPath(page)) {
835
831
  const localizedPage = `/${locale.code}${page}`;
836
832
  const routeRule = routeRules[page];
837
833
  if (routeRule && routeRule.prerender === false) {
@@ -22,7 +22,8 @@ export function useI18n() {
22
22
  $switchLocale: nuxtApp.$switchLocale,
23
23
  $switchRoute: nuxtApp.$switchRoute,
24
24
  $localeRoute: nuxtApp.$localeRoute,
25
- $localePath: nuxtApp.$localePath
25
+ $localePath: nuxtApp.$localePath,
26
+ $loadPageTranslations: nuxtApp.$loadPageTranslations
26
27
  };
27
28
  const noDollarInjections = Object.fromEntries(
28
29
  Object.entries(injections).map(([key, value]) => [key.slice(1), value])
@@ -27,6 +27,7 @@ declare const _default: import("nuxt/app").Plugin<{
27
27
  localeRoute: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => RouteLocationResolved;
28
28
  localePath: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => string;
29
29
  setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
30
+ loadPageTranslations: (locale: string, routeName: string, translations: Translations) => Promise<void>;
30
31
  }> & import("nuxt/app").ObjectPlugin<{
31
32
  i18n: undefined;
32
33
  __micro: boolean;
@@ -54,6 +55,7 @@ declare const _default: import("nuxt/app").Plugin<{
54
55
  localeRoute: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => RouteLocationResolved;
55
56
  localePath: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => string;
56
57
  setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
58
+ loadPageTranslations: (locale: string, routeName: string, translations: Translations) => Promise<void>;
57
59
  }>;
58
60
  export default _default;
59
61
  export interface PluginsInjections {
@@ -80,4 +82,5 @@ export interface PluginsInjections {
80
82
  $localeRoute: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => RouteLocationResolved;
81
83
  $localePath: (to: RouteLocationNamedRaw | RouteLocationResolvedGeneric | string, locale?: string) => string;
82
84
  $setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
85
+ $loadPageTranslations: (locale: string, routeName: string, translations: Translations) => Promise<void>;
83
86
  }
@@ -218,6 +218,9 @@ export default defineNuxtPlugin(async (nuxtApp) => {
218
218
  setI18nRouteParams: (value) => {
219
219
  i18nRouteParams.value = value;
220
220
  return i18nRouteParams.value;
221
+ },
222
+ loadPageTranslations: async (locale, routeName, translations) => {
223
+ await i18nHelper.loadPageTranslations(locale, routeName, translations);
221
224
  }
222
225
  };
223
226
  const $provideData = Object.fromEntries(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.94.0",
3
+ "version": "1.96.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",