nuxt-i18n-micro 1.28.0 → 1.29.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 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/Czi4MokJ.js">
4
+ <link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/mVL4Ag1z.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/BfH8Q6Ot.js">
8
- <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/0GmYR_kR.js">
7
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/B3qz2zap.js">
8
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CtNJ_juG.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/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},1729325923214,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"be20711c-09b4-4275-a779-8234f5aad9c8",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
10
+ <link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CKE-slgQ.js">
11
+ <script type="module" src="/__nuxt-i18n-micro/_nuxt/mVL4Ag1z.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},1729326556734,false]</script>
12
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"586a38c7-df12-4fac-ae0d-f67dd0448804",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.28.0",
4
+ "version": "1.29.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -57,7 +57,7 @@ declare const _default: import("#app").Plugin<{
57
57
  export default _default;
58
58
  export interface PluginsInjections {
59
59
  $getLocale: () => string;
60
- $getLocaleName: () => string;
60
+ $getLocaleName: () => string | null;
61
61
  $getLocales: () => Locale[];
62
62
  $defaultLocale: () => string | undefined;
63
63
  $getRouteName: (route?: RouteLocationNormalizedLoaded | RouteLocationResolvedGeneric, locale?: string) => string;
@@ -17,18 +17,12 @@ function getCurrentLocale(route, i18nConfig, hashLocale) {
17
17
  return (route.params?.locale ?? i18nConfig.defaultLocale).toString();
18
18
  }
19
19
  function getCurrentName(route, i18nConfig, hashLocale) {
20
- let currentLocale = i18nConfig.defaultLocale;
21
- if (i18nConfig.hashMode && hashLocale) {
22
- currentLocale = hashLocale;
23
- } else if (route.params?.locale) {
24
- currentLocale = (route.params?.locale ?? i18nConfig.defaultLocale).toString();
25
- }
26
- const checkLocale = i18nConfig.locales?.find((l) => l.code === currentLocale);
27
- if (!checkLocale || !checkLocale.displayName) {
28
- console.warn(`current locale name not found`);
20
+ const currentLocaleCode = getCurrentLocale(route, i18nConfig, hashLocale);
21
+ const checkLocale = i18nConfig.locales?.find((l) => l.code === currentLocaleCode);
22
+ if (!checkLocale) {
29
23
  return null;
30
24
  }
31
- return checkLocale.displayName;
25
+ return checkLocale?.displayName ?? null;
32
26
  }
33
27
  function getRouteName(route, locale) {
34
28
  return (route?.name ?? "").toString().replace("localized-", "").replace(new RegExp(`-${locale}$`), "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "1.28.0",
3
+ "version": "1.29.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",