nuxt-i18n-micro 3.20.0 → 3.21.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 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"5a55317c-1ad8-41ca-a7f6-2fe58e16b2f6",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1781512938774,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"0792ea61-cd2b-4714-91c8-a8e7805549a8",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782394434395,false]</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"5a55317c-1ad8-41ca-a7f6-2fe58e16b2f6",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1781512938774,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"0792ea61-cd2b-4714-91c8-a8e7805549a8",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782394434396,false]</script></body></html>
@@ -1 +1 @@
1
- {"id":"5a55317c-1ad8-41ca-a7f6-2fe58e16b2f6","timestamp":1781512935536}
1
+ {"id":"0792ea61-cd2b-4714-91c8-a8e7805549a8","timestamp":1782394431420}
@@ -0,0 +1 @@
1
+ {"id":"0792ea61-cd2b-4714-91c8-a8e7805549a8","timestamp":1782394431420,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"5a55317c-1ad8-41ca-a7f6-2fe58e16b2f6",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1781512938774,false]</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.Kj_DYE7z.css" crossorigin><link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js"><script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/SDQMalAT.js" crossorigin></script><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.CyBDSRXN.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/Dx6dmpFi.js"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/BA2bGsrZ.js"><link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DJtCwW7w.css"><link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/C_HK2snF.js"></head><body><div id="__nuxt"></div><div id="teleports"></div><script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"0792ea61-cd2b-4714-91c8-a8e7805549a8",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script><script type="application/json" data-nuxt-data="nuxt-app" data-ssr="false" id="__NUXT_DATA__">[{"prerenderedAt":1,"serverRendered":2},1782394434396,false]</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": "3.20.0",
4
+ "version": "3.21.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -319,6 +319,14 @@ function collectDefineI18nRouteMetaFromFiles(pageFiles, rootDirs) {
319
319
  }
320
320
 
321
321
  const DEFAULT_CANONICAL_QUERY_WHITELIST = ["page", "sort", "filter", "search", "q", "query", "tag"];
322
+ const moduleRequire = createRequire(import.meta.url);
323
+ const I18N_MICRO_NITRO_TRACE_ENTRIES = [
324
+ "@i18n-micro/utils/route",
325
+ "@i18n-micro/core",
326
+ "@i18n-micro/route-strategy",
327
+ "@i18n-micro/path-strategy",
328
+ "@i18n-micro/hmr/cache-keys"
329
+ ];
322
330
  function generateI18nTypes() {
323
331
  return `
324
332
  import type {PluginsInjections} from "nuxt-i18n-micro";
@@ -761,6 +769,17 @@ declare module '#i18n-internal/plural' {
761
769
  nitroConfig.alias["#i18n-internal/plural"] = pluralTemplate.dst;
762
770
  nitroConfig.alias["#i18n-internal/strategy"] = strategyTemplate.dst;
763
771
  nitroConfig.alias["#i18n-internal/config"] = configTemplate.dst;
772
+ nitroConfig.externals = nitroConfig.externals || {};
773
+ nitroConfig.externals.traceInclude = nitroConfig.externals.traceInclude || [];
774
+ for (const entry of I18N_MICRO_NITRO_TRACE_ENTRIES) {
775
+ try {
776
+ const resolved = moduleRequire.resolve(entry);
777
+ if (!nitroConfig.externals.traceInclude.includes(resolved)) {
778
+ nitroConfig.externals.traceInclude.push(resolved);
779
+ }
780
+ } catch {
781
+ }
782
+ }
764
783
  if (translationPayloads.serverAssets) {
765
784
  nitroConfig.serverAssets = nitroConfig.serverAssets || [];
766
785
  nitroConfig.serverAssets.push({
@@ -0,0 +1,10 @@
1
+ import type { I18nHeadInput } from '@i18n-micro/types';
2
+ import type { MaybeRefOrGetter } from 'vue';
3
+ /**
4
+ * Register page-level overrides for i18n SEO head tags.
5
+ * Merged on top of `useLocaleHead` output by the `02.meta` plugin.
6
+ */
7
+ export declare function useI18nHead(input?: MaybeRefOrGetter<I18nHeadInput | null>): {
8
+ pageHead: import("vue").Ref<I18nHeadInput | null, I18nHeadInput | null>;
9
+ resetPageHead: () => void;
10
+ };
@@ -0,0 +1,18 @@
1
+ import { toValue, watch } from "vue";
2
+ import { useState } from "#app";
3
+ export function useI18nHead(input) {
4
+ const pageHead = useState("i18n-head-page", () => null);
5
+ const resetPageHead = () => {
6
+ pageHead.value = null;
7
+ };
8
+ if (input !== void 0) {
9
+ watch(
10
+ () => toValue(input),
11
+ (value) => {
12
+ pageHead.value = value ?? null;
13
+ },
14
+ { immediate: true, deep: true }
15
+ );
16
+ }
17
+ return { pageHead, resetPageHead };
18
+ }
@@ -1,5 +1,6 @@
1
1
  import { isNoPrefixStrategy } from "@i18n-micro/core";
2
2
  import { findAllowedLocalesForRoute } from "@i18n-micro/utils/route";
3
+ import { resolveOgLocale, warnUnresolvedOgLocale } from "@i18n-micro/utils/resolve-og-locale";
3
4
  import { joinURL, parseURL, withQuery } from "ufo";
4
5
  import { ref, unref, watch } from "vue";
5
6
  import { useNuxtApp, useRoute } from "#app";
@@ -59,7 +60,8 @@ export const useLocaleHead = ({
59
60
  const enabledLocales = allLocales.filter((loc) => !loc.disabled);
60
61
  const locales = currentRouteLocales ? enabledLocales.filter((loc) => currentRouteLocales.includes(loc.code)) : enabledLocales;
61
62
  const currentIso = currentLocale.iso || locale;
62
- const currentOg = currentLocale.og || currentIso;
63
+ const currentOg = resolveOgLocale(currentLocale);
64
+ const missingWarn = i18nConfig.missingWarn ?? true;
63
65
  const currentDir = currentLocale.dir || "auto";
64
66
  let fullPath = unref(route.fullPath);
65
67
  if (!fullPath.startsWith("/")) {
@@ -77,34 +79,40 @@ export const useLocaleHead = ({
77
79
  canonicalPath = filterQuery(fullPath, canonicalQueryWhitelist ?? []);
78
80
  ogUrl = joinURL(unref(baseUrl), canonicalPath);
79
81
  }
80
- metaObject.value = {
81
- htmlAttrs: {
82
- lang: currentIso,
83
- ...addDirAttribute ? { dir: currentDir } : {}
84
- },
85
- link: [],
86
- meta: []
82
+ const htmlAttrs = {
83
+ lang: currentIso,
84
+ ...addDirAttribute ? { dir: currentDir } : {}
87
85
  };
88
- if (!addSeoAttributes) return;
86
+ if (!addSeoAttributes) {
87
+ metaObject.value = { htmlAttrs, link: [], meta: [] };
88
+ return;
89
+ }
89
90
  const localesForSeo = locales.filter((loc) => loc.seo !== false);
90
- const ogLocaleMeta = {
91
+ if (!currentOg) {
92
+ warnUnresolvedOgLocale(currentLocale, { missingWarn, tag: "og:locale" });
93
+ }
94
+ const ogLocaleMeta = currentOg ? {
91
95
  [identifierAttribute]: "i18n-og",
92
96
  property: "og:locale",
93
- content: unref(currentOg)
94
- };
97
+ content: currentOg
98
+ } : null;
95
99
  const ogUrlMeta = {
96
100
  [identifierAttribute]: "i18n-og-url",
97
101
  property: "og:url",
98
102
  content: ogUrl
99
103
  };
100
104
  const alternateOgLocalesMeta = localesForSeo.filter((loc) => loc.code !== locale).map((loc) => {
101
- const ogAlt = loc.og || loc.iso || loc.code;
105
+ const ogAlt = resolveOgLocale(loc);
106
+ if (!ogAlt) {
107
+ warnUnresolvedOgLocale(loc, { missingWarn, tag: "og:locale:alternate" });
108
+ return null;
109
+ }
102
110
  return {
103
111
  [identifierAttribute]: `i18n-og-alt-${ogAlt}`,
104
112
  property: "og:locale:alternate",
105
- content: unref(ogAlt)
113
+ content: ogAlt
106
114
  };
107
- });
115
+ }).filter((meta) => meta !== null);
108
116
  const canonicalLink = {
109
117
  [identifierAttribute]: "i18n-can",
110
118
  rel: "canonical",
@@ -162,8 +170,11 @@ export const useLocaleHead = ({
162
170
  };
163
171
  }
164
172
  }
165
- metaObject.value.meta = [ogLocaleMeta, ogUrlMeta, ...alternateOgLocalesMeta];
166
- metaObject.value.link = [canonicalLink, ...alternateLinks, ...xDefaultLink ? [xDefaultLink] : []];
173
+ metaObject.value = {
174
+ htmlAttrs,
175
+ meta: [...ogLocaleMeta ? [ogLocaleMeta] : [], ogUrlMeta, ...alternateOgLocalesMeta],
176
+ link: [canonicalLink, ...alternateLinks, ...xDefaultLink ? [xDefaultLink] : []]
177
+ };
167
178
  }
168
179
  if (autoUpdate) {
169
180
  watch(
@@ -84,7 +84,7 @@ export interface PluginsInjections {
84
84
  $tc: (key: string, params: number | Params, defaultValue?: string) => string;
85
85
  $tn: (value: number, options?: Intl.NumberFormatOptions) => string;
86
86
  $td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
87
- $tdr: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
87
+ $tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string;
88
88
  $has: (key: string) => boolean;
89
89
  $mergeTranslations: (newTranslations: Translations) => void;
90
90
  $switchLocaleRoute: (locale: string) => RouteLocationRaw;
@@ -4,6 +4,7 @@ import { useState } from "#app";
4
4
  import { plural } from "#build/i18n.plural.mjs";
5
5
  import { createI18nStrategy, getI18nConfig } from "#build/i18n.strategy.mjs";
6
6
  import { createError, defineNuxtPlugin, navigateTo, useRouter, useRuntimeConfig } from "#imports";
7
+ import { useI18nHead } from "../composables/useI18nHead.js";
7
8
  import { useI18nLocale } from "../composables/useI18nLocale.js";
8
9
  import { createNuxtI18nPluginApi, NuxtI18n, NuxtTranslationLoader } from "../utils/nuxt-i18n.js";
9
10
  import { translationStorage } from "../utils/storage.js";
@@ -22,6 +23,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
22
23
  });
23
24
  const { locale: localeState, setLocale, getLocale, getEffectiveLocale, resolveInitialLocale, isValidLocale } = useI18nLocale();
24
25
  const i18nRouteParams = useState("i18n-route-params", () => ({}));
26
+ const { resetPageHead } = useI18nHead();
25
27
  const customMissingHandler = useState("i18n-missing-handler", () => null);
26
28
  const ssrChunks = useState("i18n-ssr-chunks", () => ({}));
27
29
  const i18n = new NuxtI18n({
@@ -109,6 +111,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
109
111
  router.beforeEach(async (to, from) => {
110
112
  if (to.name !== from.name) {
111
113
  i18nRouteParams.value = {};
114
+ resetPageHead();
112
115
  }
113
116
  const shouldSwitchContext = to.path !== from.path || isNoPrefixStrategy(i18nConfig.strategy);
114
117
  if (!shouldSwitchContext) {
@@ -1,11 +1,15 @@
1
+ import { mergeI18nHead } from "@i18n-micro/utils/merge-i18n-head";
1
2
  import { isMetaDisabledForRoute } from "@i18n-micro/utils/route";
2
3
  import { resolveI18nConfigWithRuntimeOverrides } from "@i18n-micro/utils/runtime-config";
3
- import { watch } from "vue";
4
+ import { computed, watch } from "vue";
4
5
  import { getI18nConfig } from "#build/i18n.strategy.mjs";
5
- import { defineNuxtPlugin, useHead, useRequestURL, useRoute } from "#imports";
6
+ import { defineNuxtPlugin, useHead, useRequestURL, useRoute, useState } from "#imports";
7
+ import { useI18nHead } from "../composables/useI18nHead.js";
6
8
  import { useLocaleHead } from "../composables/useLocaleHead.js";
7
9
  export default defineNuxtPlugin((nuxtApp) => {
8
10
  const route = useRoute();
11
+ const i18nRouteParams = useState("i18n-route-params", () => ({}));
12
+ const { pageHead } = useI18nHead();
9
13
  const getRuntimeConfig = nuxtApp.$getI18nConfig;
10
14
  const i18nConfig = resolveI18nConfigWithRuntimeOverrides(
11
15
  typeof getRuntimeConfig === "function" ? getRuntimeConfig() : getI18nConfig()
@@ -26,14 +30,25 @@ export default defineNuxtPlugin((nuxtApp) => {
26
30
  baseUrl,
27
31
  autoUpdate: false
28
32
  });
29
- useHead(metaObject);
33
+ const mergedHead = computed(() => {
34
+ const { $getLocales, $getLocale } = nuxtApp;
35
+ const allLocales = $getLocales?.() ?? i18nConfig.locales ?? [];
36
+ const locale = $getLocale?.() || i18nConfig.defaultLocale || "en";
37
+ return mergeI18nHead(metaObject.value, pageHead.value, {
38
+ identifierAttribute: "id",
39
+ locales: allLocales,
40
+ currentLocale: locale
41
+ });
42
+ });
43
+ useHead(mergedHead);
44
+ const refreshMeta = () => updateMeta();
30
45
  if (import.meta.server) {
31
- updateMeta();
32
- } else if (import.meta.client) {
33
- watch(
34
- () => route.fullPath,
35
- () => updateMeta(),
36
- { immediate: true }
37
- );
46
+ nuxtApp.hook("app:rendered", refreshMeta);
47
+ } else {
48
+ refreshMeta();
49
+ nuxtApp.hook("page:finish", refreshMeta);
38
50
  }
51
+ watch(() => i18nRouteParams.value, refreshMeta, { deep: true, flush: "post" });
52
+ watch(() => [route.fullPath, route.name, route.matched.length], refreshMeta, { flush: "post" });
53
+ watch(pageHead, refreshMeta, { deep: true, flush: "post" });
39
54
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "3.20.0",
3
+ "version": "3.21.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",
@@ -76,13 +76,13 @@
76
76
  "ufo": "^1.5.4",
77
77
  "unplugin": "^1.16.1",
78
78
  "@vue/compiler-sfc": "^3.5.25",
79
- "@i18n-micro/hmr": "1.0.1",
80
79
  "@i18n-micro/core": "1.3.2",
80
+ "@i18n-micro/route-strategy": "1.1.8",
81
81
  "@i18n-micro/path-strategy": "1.3.3",
82
- "@i18n-micro/types": "1.2.4",
82
+ "@i18n-micro/types": "1.2.6",
83
+ "@i18n-micro/utils": "1.0.3",
83
84
  "@i18n-micro/test-utils": "1.2.2",
84
- "@i18n-micro/route-strategy": "1.1.8",
85
- "@i18n-micro/utils": "1.0.1"
85
+ "@i18n-micro/hmr": "1.0.1"
86
86
  },
87
87
  "devDependencies": {
88
88
  "oxfmt": "^0.43.0",
@@ -1 +0,0 @@
1
- {"id":"5a55317c-1ad8-41ca-a7f6-2fe58e16b2f6","timestamp":1781512935536,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}