nuxt-i18n-micro 1.26.4 → 1.27.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
- {"id":"550a2c5b-067a-43d1-9873-f052247b646e","timestamp":1729244800341}
1
+ {"id":"ae460766-4aac-4e10-8148-f637be2c18a6","timestamp":1729272329466}
@@ -0,0 +1 @@
1
+ {"id":"ae460766-4aac-4e10-8148-f637be2c18a6","timestamp":1729272329466,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -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.BqOlM4b6.css">
4
- <link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DdNTZZXx.js">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.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.C_4C5G96.css">
7
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/C1Wf4olg.js">
8
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CTTs5VTZ.js">
7
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/BfH8Q6Ot.js">
8
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/0GmYR_kR.js">
9
9
  <link rel="prefetch" as="style" crossorigin href="/__nuxt-i18n-micro/_nuxt/error-500.CBAEdpZV.css">
10
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/r0-q9WyQ.js">
11
- <script type="module" src="/__nuxt-i18n-micro/_nuxt/DdNTZZXx.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},1729244810739,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"550a2c5b-067a-43d1-9873-f052247b646e",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/2C6ahHCU.js">
11
+ <script type="module" src="/__nuxt-i18n-micro/_nuxt/Czi4MokJ.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},1729272343292,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"ae460766-4aac-4e10-8148-f637be2c18a6",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.26.4",
4
+ "version": "1.27.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -17,6 +17,7 @@ export function useI18n() {
17
17
  $switchLocaleRoute: nuxtApp.$switchLocaleRoute,
18
18
  $switchLocalePath: nuxtApp.$switchLocalePath,
19
19
  $switchLocale: nuxtApp.$switchLocale,
20
+ $switchRoute: nuxtApp.$switchRoute,
20
21
  $localeRoute: nuxtApp.$localeRoute,
21
22
  $localePath: nuxtApp.$localePath
22
23
  };
@@ -26,6 +26,7 @@ declare const _default: import("#app").Plugin<{
26
26
  switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
27
27
  switchLocalePath: (toLocale: string) => string;
28
28
  switchLocale: (toLocale: string) => void;
29
+ switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
29
30
  localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationResolved;
30
31
  localePath: (to: RouteLocationRaw, locale?: string) => string;
31
32
  setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
@@ -46,6 +47,7 @@ declare const _default: import("#app").Plugin<{
46
47
  switchLocaleRoute: (toLocale: string) => string | import("vue-router").RouteLocationAsRelativeGeneric | import("vue-router").RouteLocationAsPathGeneric;
47
48
  switchLocalePath: (toLocale: string) => string;
48
49
  switchLocale: (toLocale: string) => void;
50
+ switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
49
51
  localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationResolved;
50
52
  localePath: (to: RouteLocationRaw, locale?: string) => string;
51
53
  setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
@@ -66,6 +68,7 @@ export interface PluginsInjections {
66
68
  $switchLocaleRoute: (locale: string) => RouteLocationRaw;
67
69
  $switchLocalePath: (locale: string) => string;
68
70
  $switchLocale: (locale: string) => void;
71
+ $switchRoute: (route: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric | string, toLocale?: string) => void;
69
72
  $localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationResolved;
70
73
  $localePath: (to: RouteLocationRaw, locale?: string) => string;
71
74
  $setI18nRouteParams: (value: I18nRouteParams) => I18nRouteParams;
@@ -247,6 +247,17 @@ export default defineNuxtPlugin(async (nuxtApp) => {
247
247
  }
248
248
  switchLocale(fromLocale, toLocale, route, router, i18nConfig, i18nRouteParams.value);
249
249
  },
250
+ switchRoute: (route, toLocale) => {
251
+ const router = useRouter();
252
+ if (typeof route === "string") {
253
+ route = router.resolve(route);
254
+ }
255
+ const fromLocale = getCurrentLocale(route, i18nConfig, hashLocale);
256
+ if (i18nConfig.hashMode) {
257
+ hashLocale = toLocale ?? fromLocale;
258
+ }
259
+ switchLocale(fromLocale, toLocale ?? fromLocale, route, router, i18nConfig, i18nRouteParams.value);
260
+ },
250
261
  localeRoute: (to, locale) => {
251
262
  const router = useRouter();
252
263
  const route = useRoute();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.26.4",
3
+ "version": "1.27.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",