nuxt-i18n-micro 2.12.1 → 2.14.1

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.
Files changed (43) hide show
  1. package/dist/client/200.html +9 -10
  2. package/dist/client/404.html +9 -10
  3. package/dist/client/_nuxt/B24OA-uO.js +1 -0
  4. package/dist/client/_nuxt/CF4LIYi0.js +1 -0
  5. package/dist/client/_nuxt/CaEXoJJV.js +1 -0
  6. package/dist/client/_nuxt/DS5b1XNW.js +13 -0
  7. package/dist/client/_nuxt/builds/latest.json +1 -1
  8. package/dist/client/_nuxt/builds/meta/46b0e0bb-534a-4737-a2cf-ea118c508d77.json +1 -0
  9. package/dist/client/_nuxt/entry.v6jsTdX3.css +1 -0
  10. package/dist/client/_nuxt/error-404.Bee8QxB2.css +1 -0
  11. package/dist/client/_nuxt/error-500.DqTJYfAv.css +1 -0
  12. package/dist/client/index.html +9 -10
  13. package/dist/module.d.mts +2 -2
  14. package/dist/module.json +1 -1
  15. package/dist/module.mjs +48 -23
  16. package/dist/runtime/components/i18n-t.vue.d.ts +1 -1
  17. package/dist/runtime/components/locale-redirect.vue +1 -1
  18. package/dist/runtime/composables/useLocaleHead.js +1 -1
  19. package/dist/runtime/locale-server-middleware.d.ts +1 -1
  20. package/dist/runtime/locale-server-middleware.js +6 -1
  21. package/dist/runtime/plugins/01.plugin.d.ts +6 -6
  22. package/dist/runtime/plugins/01.plugin.js +1 -1
  23. package/dist/runtime/plugins/03.define.d.ts +1 -1
  24. package/dist/runtime/plugins/04.auto-detect.js +1 -1
  25. package/dist/runtime/plugins/05.hooks.js +1 -1
  26. package/dist/runtime/plugins/06.redirect.js +6 -6
  27. package/dist/runtime/server/routes/get.js +2 -2
  28. package/dist/runtime/translation-server-middleware.d.ts +1 -1
  29. package/dist/runtime/translation-server-middleware.js +8 -3
  30. package/dist/runtime/utils/locale-detector.d.ts +4 -0
  31. package/dist/runtime/utils/locale-detector.js +21 -3
  32. package/dist/runtime/utils/route-utils.js +2 -0
  33. package/dist/types.d.mts +1 -1
  34. package/package.json +5 -4
  35. package/dist/client/_nuxt/BYEpoBUk.js +0 -1
  36. package/dist/client/_nuxt/CBxwnKtU.js +0 -1
  37. package/dist/client/_nuxt/CQupjgaS.js +0 -1
  38. package/dist/client/_nuxt/XZXfxmri.js +0 -3853
  39. package/dist/client/_nuxt/builds/meta/df255026-5ffe-4c47-b2f1-585895bcd2e6.json +0 -1
  40. package/dist/client/_nuxt/entry.Cq9tULRb.css +0 -1
  41. package/dist/client/_nuxt/error-404.Ba2SLv0l.css +0 -1
  42. package/dist/client/_nuxt/error-500.BqKd8Zt-.css +0 -1
  43. package/dist/client/_nuxt/l5rcX3cq.js +0 -8
@@ -1 +1 @@
1
- {"id":"df255026-5ffe-4c47-b2f1-585895bcd2e6","timestamp":1764744429004}
1
+ {"id":"46b0e0bb-534a-4737-a2cf-ea118c508d77","timestamp":1765185908285}
@@ -0,0 +1 @@
1
+ {"id":"46b0e0bb-534a-4737-a2cf-ea118c508d77","timestamp":1765185908285,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
@@ -0,0 +1 @@
1
+ :root{--nui-c-context:125,125,125}html{background-color:#fff}html.dark{background-color:#151515;color:#fff;color-scheme:dark}::-moz-selection{background:#8884}::selection{background:#8884}.shiki .line{display:inline-block;position:relative;width:100%}.shiki.diff .line>span{filter:saturate(.75);opacity:.75}.shiki.diff .line-added,.shiki.diff .line-removed{scroll-margin:5em}.shiki.diff .line-added>span,.shiki.diff .line-removed>span{opacity:1!important;position:inherit;scroll-margin:20px;z-index:100}.shiki.diff .line-added>span{color:#218c3b!important}.shiki.diff .line-removed>span{color:#d15547!important}.shiki .line-added:after{background-color:#43885420}.shiki .line-added:after,.shiki .line-removed:after{content:"";display:block;inset:0;position:absolute}.shiki .line-removed:after{background-color:#8f4c3926}::view-transition-new(root),::view-transition-old(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:2147483646}.dark::view-transition-old(root){z-index:2147483646}.dark::view-transition-new(root){z-index:1}*,:after,:before{border-color:var(--un-default-border-color, #e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content: ""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}@font-face{font-display:swap;font-family:DM Mono;font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/dmmono/v16/aFTU7PB1QTsUX8KYthSQBK6PYK3EXw.woff2) format("woff2");unicode-range:u+0100-02ba,u+02bd-02c5,u+02c7-02cc,u+02ce-02d7,u+02dd-02ff,u+0304,u+0308,u+0329,u+1d00-1dbf,u+1e00-1e9f,u+1ef2-1eff,u+2020,u+20a0-20ab,u+20ad-20c0,u+2113,u+2c60-2c7f,u+a720-a7ff}@font-face{font-display:swap;font-family:DM Mono;font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/dmmono/v16/aFTU7PB1QTsUX8KYthqQBK6PYK0.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRR232RmYJp8I5zzw.woff2) format("woff2");unicode-range:u+0100-02ba,u+02bd-02c5,u+02c7-02cc,u+02ce-02d7,u+02dd-02ff,u+0304,u+0308,u+0329,u+1d00-1dbf,u+1e00-1e9f,u+1ef2-1eff,u+2020,u+20a0-20ab,u+20ad-20c0,u+2113,u+2c60-2c7f,u+a720-a7ff}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/dmsans/v17/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRSW32RmYJp8I5.woff2) format("woff2");unicode-range:u+00??,u+0131,u+0152-0153,u+02bb-02bc,u+02c6,u+02da,u+02dc,u+0304,u+0308,u+0329,u+2000-206f,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }::backdrop{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }.container{width:100%}@media(min-width:640px){.container{max-width:640px}}@media(min-width:768px){.container{max-width:768px}}@media(min-width:1024px){.container{max-width:1024px}}@media(min-width:1280px){.container{max-width:1280px}}@media(min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.fixed{position:fixed}.-bottom-1\/2{bottom:-50%}.left-0{left:0}.right-0{right:0}.z-10{z-index:10}.z-20{z-index:20}.grid{display:grid}.mb-16{margin-bottom:4rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.h-1\/2{height:50%}.h-auto{height:auto}.h1{height:.25rem}.max-w-520px{max-width:520px}.min-h-screen{min-height:100vh}.w-full{width:100%}.flex{display:flex}.flex-1{flex:1 1 0%}.flex-col{flex-direction:column}.cursor-pointer{cursor:pointer}.place-content-center{place-content:center}.items-center{align-items:center}.justify-center{justify-content:center}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.bg-black\/5{background-color:#0000000d}.bg-white{--un-bg-opacity:1;background-color:rgb(255 255 255 / var(--un-bg-opacity))}.dark .dark\:bg-black{--un-bg-opacity:1;background-color:rgb(0 0 0 / var(--un-bg-opacity))}.dark .dark\:bg-white\/10{background-color:#ffffff1a}.p-8{padding:2rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.pt-14{padding-top:3.5rem}.text-center{text-align:center}.text-6xl{font-size:3.75rem;line-height:1}.text-8xl{font-size:6rem;line-height:1}.text-xl{font-size:1.25rem;line-height:1.75rem}.dark .dark\:text-white{--un-text-opacity:1;color:rgb(255 255 255 / var(--un-text-opacity))}.text-black{--un-text-opacity:1;color:rgb(0 0 0 / var(--un-text-opacity))}.font-light{font-weight:300}.font-medium{font-weight:500}.leading-tight{line-height:1.25}.font-sans{font-family:DM Sans,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@media(min-width:640px){.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-8xl{font-size:6rem;line-height:1}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}
@@ -0,0 +1 @@
1
+ .spotlight[data-v-55672b69]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);bottom:-30vh;filter:blur(20vh);height:40vh}.gradient-border[data-v-55672b69]{-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border-radius:.5rem;position:relative}@media(prefers-color-scheme:light){.gradient-border[data-v-55672b69]{background-color:#ffffff4d}.gradient-border[data-v-55672b69]:before{background:linear-gradient(90deg,#e2e2e2,#e2e2e2 25%,#00dc82,#36e4da 75%,#0047e1)}}@media(prefers-color-scheme:dark){.gradient-border[data-v-55672b69]{background-color:#1414144d}.gradient-border[data-v-55672b69]:before{background:linear-gradient(90deg,#303030,#303030 25%,#00dc82,#36e4da 75%,#0047e1)}}.gradient-border[data-v-55672b69]:before{background-size:400% auto;border-radius:.5rem;content:"";inset:0;-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude;opacity:.5;padding:2px;position:absolute;transition:background-position .3s ease-in-out,opacity .2s ease-in-out;width:100%}.gradient-border[data-v-55672b69]:hover:before{background-position:-50% 0;opacity:1}.fixed[data-v-55672b69]{position:fixed}.left-0[data-v-55672b69]{left:0}.right-0[data-v-55672b69]{right:0}.z-10[data-v-55672b69]{z-index:10}.z-20[data-v-55672b69]{z-index:20}.grid[data-v-55672b69]{display:grid}.mb-16[data-v-55672b69]{margin-bottom:4rem}.mb-8[data-v-55672b69]{margin-bottom:2rem}.max-w-520px[data-v-55672b69]{max-width:520px}.min-h-screen[data-v-55672b69]{min-height:100vh}.w-full[data-v-55672b69]{width:100%}.flex[data-v-55672b69]{display:flex}.cursor-pointer[data-v-55672b69]{cursor:pointer}.place-content-center[data-v-55672b69]{place-content:center}.items-center[data-v-55672b69]{align-items:center}.justify-center[data-v-55672b69]{justify-content:center}.overflow-hidden[data-v-55672b69]{overflow:hidden}.bg-white[data-v-55672b69]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-4[data-v-55672b69]{padding-left:1rem;padding-right:1rem}.px-8[data-v-55672b69]{padding-left:2rem;padding-right:2rem}.py-2[data-v-55672b69]{padding-bottom:.5rem;padding-top:.5rem}.text-center[data-v-55672b69]{text-align:center}.text-8xl[data-v-55672b69]{font-size:6rem;line-height:1}.text-xl[data-v-55672b69]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-55672b69]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-55672b69]{font-weight:300}.font-medium[data-v-55672b69]{font-weight:500}.leading-tight[data-v-55672b69]{line-height:1.25}.font-sans[data-v-55672b69]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-55672b69]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-black[data-v-55672b69]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-55672b69]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:px-0[data-v-55672b69]{padding-left:0;padding-right:0}.sm\:px-6[data-v-55672b69]{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-3[data-v-55672b69]{padding-bottom:.75rem;padding-top:.75rem}.sm\:text-4xl[data-v-55672b69]{font-size:2.25rem;line-height:2.5rem}.sm\:text-xl[data-v-55672b69]{font-size:1.25rem;line-height:1.75rem}}
@@ -0,0 +1 @@
1
+ .spotlight[data-v-d7d76eec]{background:linear-gradient(45deg,#00dc82,#36e4da 50%,#0047e1);filter:blur(20vh)}.fixed[data-v-d7d76eec]{position:fixed}.-bottom-1\/2[data-v-d7d76eec]{bottom:-50%}.left-0[data-v-d7d76eec]{left:0}.right-0[data-v-d7d76eec]{right:0}.grid[data-v-d7d76eec]{display:grid}.mb-16[data-v-d7d76eec]{margin-bottom:4rem}.mb-8[data-v-d7d76eec]{margin-bottom:2rem}.h-1\/2[data-v-d7d76eec]{height:50%}.max-w-520px[data-v-d7d76eec]{max-width:520px}.min-h-screen[data-v-d7d76eec]{min-height:100vh}.place-content-center[data-v-d7d76eec]{place-content:center}.overflow-hidden[data-v-d7d76eec]{overflow:hidden}.bg-white[data-v-d7d76eec]{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.px-8[data-v-d7d76eec]{padding-left:2rem;padding-right:2rem}.text-center[data-v-d7d76eec]{text-align:center}.text-8xl[data-v-d7d76eec]{font-size:6rem;line-height:1}.text-xl[data-v-d7d76eec]{font-size:1.25rem;line-height:1.75rem}.text-black[data-v-d7d76eec]{--un-text-opacity:1;color:rgb(0 0 0/var(--un-text-opacity))}.font-light[data-v-d7d76eec]{font-weight:300}.font-medium[data-v-d7d76eec]{font-weight:500}.leading-tight[data-v-d7d76eec]{line-height:1.25}.font-sans[data-v-d7d76eec]{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.antialiased[data-v-d7d76eec]{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media(prefers-color-scheme:dark){.dark\:bg-black[data-v-d7d76eec]{--un-bg-opacity:1;background-color:rgb(0 0 0/var(--un-bg-opacity))}.dark\:text-white[data-v-d7d76eec]{--un-text-opacity:1;color:rgb(255 255 255/var(--un-text-opacity))}}@media(min-width:640px){.sm\:px-0[data-v-d7d76eec]{padding-left:0;padding-right:0}.sm\:text-4xl[data-v-d7d76eec]{font-size:2.25rem;line-height:2.5rem}}
@@ -1,12 +1,11 @@
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.Cq9tULRb.css" crossorigin>
4
- <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/XZXfxmri.js">
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.Ba2SLv0l.css">
7
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CQupjgaS.js">
8
- <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CBxwnKtU.js">
9
- <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.BqKd8Zt-.css">
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},1764744435308,false]</script>
12
- <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"df255026-5ffe-4c47-b2f1-585895bcd2e6",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
3
+ <link rel="stylesheet" href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/entry.v6jsTdX3.css" crossorigin>
4
+ <link rel="modulepreload" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DS5b1XNW.js">
5
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-404.Bee8QxB2.css">
6
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/B24OA-uO.js">
7
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CaEXoJJV.js">
8
+ <link rel="prefetch" as="style" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/error-500.DqTJYfAv.css">
9
+ <link rel="prefetch" as="script" crossorigin href="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/CF4LIYi0.js">
10
+ <script type="module" src="/__NUXT_DEVTOOLS_I18N_BASE__/_nuxt/DS5b1XNW.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},1765185910968,false]</script>
11
+ <script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__NUXT_DEVTOOLS_I18N_BASE__/",buildId:"46b0e0bb-534a-4737-a2cf-ea118c508d77",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
package/dist/module.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
  import { HookResult } from '@nuxt/schema';
3
- import { ModulePrivateOptionsExtend, ModuleOptionsExtend, ModuleOptions } from 'nuxt-i18n-micro-types';
4
- export { Getter, GlobalLocaleRoutes, Locale, LocaleCode, ModuleOptions, PluralFunc, Strategies } from 'nuxt-i18n-micro-types';
3
+ import { ModulePrivateOptionsExtend, ModuleOptionsExtend, ModuleOptions } from '@i18n-micro/types';
4
+ export { Getter, GlobalLocaleRoutes, Locale, LocaleCode, ModuleOptions, PluralFunc, Strategies } from '@i18n-micro/types';
5
5
  export { PluginsInjections } from '../dist/runtime/plugins/01.plugin.js';
6
6
 
7
7
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
3
  "configKey": "i18n",
4
- "version": "2.12.1",
4
+ "version": "2.14.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import path, { resolve, join } from 'node:path';
2
2
  import * as fs from 'node:fs';
3
3
  import fs__default, { existsSync, mkdirSync, writeFileSync, readFileSync } from 'node:fs';
4
4
  import { useNuxt, defineNuxtModule, useLogger, createResolver, addTemplate, addImportsDir, addPlugin, addServerHandler, addComponentsDir, addTypeTemplate, addPrerenderRoutes } from '@nuxt/kit';
5
- import { isPrefixAndDefaultStrategy, isPrefixStrategy, isNoPrefixStrategy, isPrefixExceptDefaultStrategy, withPrefixStrategy } from 'nuxt-i18n-micro-core';
5
+ import { isPrefixAndDefaultStrategy, isPrefixStrategy, isNoPrefixStrategy, isPrefixExceptDefaultStrategy, defaultPlural, withPrefixStrategy } from '@i18n-micro/core';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
8
8
  import sirv from 'sirv';
@@ -16,17 +16,19 @@ const clientDir = resolve(distDir, "client");
16
16
  function setupDevToolsUI(options, resolve2) {
17
17
  const nuxt = useNuxt();
18
18
  const clientPath = resolve2("./client");
19
- const clientDirExists = fs.existsSync(clientPath);
19
+ const devtoolsUiDistPath = resolve2("./packages/devtools-ui/dist");
20
+ const clientDirExists = fs.existsSync(clientPath) || fs.existsSync(devtoolsUiDistPath);
20
21
  const ROUTE_PATH = `${nuxt.options.app.baseURL || "/"}/__nuxt-i18n-micro`.replace(/\/+/g, "/");
21
22
  const ROUTE_CLIENT = `${ROUTE_PATH}/client`;
22
23
  if (clientDirExists) {
23
24
  nuxt.hook("vite:serverCreated", (server) => {
24
- const indexHtmlPath = path.join(clientDir, "index.html");
25
+ const actualClientDir = fs.existsSync(clientDir) ? clientDir : devtoolsUiDistPath;
26
+ const indexHtmlPath = path.join(actualClientDir, "index.html");
25
27
  if (!fs.existsSync(indexHtmlPath)) {
26
28
  return;
27
29
  }
28
30
  const indexContent = fs.readFileSync(indexHtmlPath);
29
- const handleStatic = sirv(clientDir, {
31
+ const handleStatic = sirv(actualClientDir, {
30
32
  dev: true,
31
33
  single: false
32
34
  });
@@ -42,6 +44,23 @@ function setupDevToolsUI(options, resolve2) {
42
44
  return handleStatic(req, res, () => handleIndex(res));
43
45
  });
44
46
  });
47
+ nuxt.hook("vite:extendConfig", (config) => {
48
+ config.server = config.server || {};
49
+ config.server.proxy = config.server.proxy || {};
50
+ const proxyConfig = {
51
+ target: "http://localhost:5173",
52
+ changeOrigin: true,
53
+ ws: true,
54
+ // Enable WebSocket proxying for HMR
55
+ rewrite: (path2) => {
56
+ return path2.replace(ROUTE_CLIENT, "");
57
+ }
58
+ };
59
+ const proxyPath = `${ROUTE_CLIENT}/_nuxt`;
60
+ config.server.proxy[proxyPath] = proxyConfig;
61
+ config.server.proxy[`${proxyPath}/`] = proxyConfig;
62
+ config.server.proxy[`${proxyPath}/*`] = proxyConfig;
63
+ });
45
64
  } else {
46
65
  nuxt.hook("vite:extendConfig", (config) => {
47
66
  config.server = config.server || {};
@@ -57,7 +76,19 @@ function setupDevToolsUI(options, resolve2) {
57
76
  onDevToolsInitialized(async () => {
58
77
  extendServerRpc("nuxt-i18n-micro", {
59
78
  async saveTranslationContent(file, content) {
60
- const filePath = path.resolve(file);
79
+ const rootDirs = nuxt.options.runtimeConfig.i18nConfig?.rootDirs || [nuxt.options.rootDir];
80
+ let filePath = null;
81
+ for (const rootDir of rootDirs) {
82
+ const localesDir = path.join(rootDir, options.translationDir || "locales");
83
+ const candidatePath = path.resolve(localesDir, file);
84
+ if (fs.existsSync(candidatePath)) {
85
+ filePath = candidatePath;
86
+ break;
87
+ }
88
+ }
89
+ if (!filePath) {
90
+ filePath = path.resolve(file);
91
+ }
61
92
  if (fs.existsSync(filePath)) {
62
93
  fs.writeFileSync(filePath, JSON.stringify(content, null, 2), "utf-8");
63
94
  } else {
@@ -73,24 +104,26 @@ function setupDevToolsUI(options, resolve2) {
73
104
  for (const rootDir of rootDirs) {
74
105
  const localesDir = path.join(rootDir, options.translationDir || "locales");
75
106
  const pagesDir = path.join(localesDir, "pages");
76
- const processDirectory = (dir) => {
107
+ const processDirectory = (dir, baseDir = localesDir) => {
77
108
  if (!fs.existsSync(dir)) return;
78
109
  fs.readdirSync(dir).forEach((file) => {
79
110
  const filePath = path.join(dir, file);
80
111
  const stat = fs.lstatSync(filePath);
81
112
  if (stat.isDirectory()) {
82
- processDirectory(filePath);
113
+ processDirectory(filePath, baseDir);
83
114
  } else if (file.endsWith(".json")) {
84
115
  try {
85
- filesList[filePath] = JSON.parse(fs.readFileSync(filePath, "utf-8"));
116
+ const relativePath = path.relative(baseDir, filePath);
117
+ const normalizedPath = relativePath.replace(/\\/g, "/");
118
+ filesList[normalizedPath] = JSON.parse(fs.readFileSync(filePath, "utf-8"));
86
119
  } catch (e) {
87
120
  console.error(`Error parsing locale file ${filePath}:`, e);
88
121
  }
89
122
  }
90
123
  });
91
124
  };
92
- processDirectory(localesDir);
93
- processDirectory(pagesDir);
125
+ processDirectory(localesDir, localesDir);
126
+ processDirectory(pagesDir, localesDir);
94
127
  }
95
128
  return filesList;
96
129
  }
@@ -111,7 +144,7 @@ function setupDevToolsUI(options, resolve2) {
111
144
 
112
145
  function extractScriptContent(content) {
113
146
  const scriptMatch = content.match(/<script[^>]*>([\s\S]*?)<\/script>/);
114
- return scriptMatch ? scriptMatch[1] : null;
147
+ return scriptMatch && scriptMatch[1] ? scriptMatch[1] : null;
115
148
  }
116
149
  function removeTypeScriptTypes(scriptContent) {
117
150
  return scriptContent.replace(/\((\w+):[^)]*\)/g, "($1)");
@@ -298,7 +331,9 @@ class PageManager {
298
331
  const normalizedLocalePaths = {};
299
332
  for (const locale in localePaths) {
300
333
  const customPath = localePaths[locale];
301
- normalizedLocalePaths[locale] = normalizeRouteKey(customPath);
334
+ if (customPath) {
335
+ normalizedLocalePaths[locale] = normalizeRouteKey(customPath);
336
+ }
302
337
  }
303
338
  normalizedGlobalRoutes[newKey] = normalizedLocalePaths;
304
339
  } else {
@@ -832,17 +867,7 @@ const module = defineNuxtModule({
832
867
  routesLocaleLinks: {},
833
868
  globalLocaleRoutes: {},
834
869
  canonicalQueryWhitelist: ["page", "sort", "filter", "search", "q", "query", "tag"],
835
- plural: (key, count, params, _locale, getTranslation) => {
836
- const translation = getTranslation(key, params);
837
- if (!translation) {
838
- return null;
839
- }
840
- const forms = translation.toString().split("|");
841
- if (forms.length === 0) return null;
842
- const selectedForm = count < forms.length ? forms[count] : forms[forms.length - 1];
843
- if (!selectedForm) return null;
844
- return selectedForm.trim().replace("{count}", count.toString());
845
- },
870
+ plural: defaultPlural,
846
871
  customRegexMatcher: void 0,
847
872
  excludePatterns: void 0,
848
873
  missingWarn: true
@@ -1,5 +1,5 @@
1
1
  import type { VNode, PropType } from 'vue';
2
- import type { PluralFunc } from 'nuxt-i18n-micro-types';
2
+ import type { PluralFunc } from '@i18n-micro/types';
3
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
4
  keypath: {
5
5
  type: PropType<string>;
@@ -5,7 +5,7 @@
5
5
  <script setup>
6
6
  import { useRoute, useRouter, useI18n, createError, navigateTo, useRuntimeConfig, showError } from "#imports";
7
7
  import { isInternalPath } from "../utils/path-utils";
8
- import { isPrefixStrategy, isPrefixExceptDefaultStrategy } from "nuxt-i18n-micro-core";
8
+ import { isPrefixStrategy, isPrefixExceptDefaultStrategy } from "@i18n-micro/core";
9
9
  const route = useRoute();
10
10
  const router = useRouter();
11
11
  const { $getLocales, $defaultLocale } = useI18n();
@@ -1,5 +1,5 @@
1
1
  import { joinURL, parseURL, withQuery } from "ufo";
2
- import { isNoPrefixStrategy } from "nuxt-i18n-micro-core";
2
+ import { isNoPrefixStrategy } from "@i18n-micro/core";
3
3
  import { useRoute, useRuntimeConfig, useNuxtApp } from "#imports";
4
4
  import { findAllowedLocalesForRoute } from "../utils/route-utils.js";
5
5
  import { ref, unref } from "vue";
@@ -1,5 +1,5 @@
1
1
  import type { H3Event } from 'h3';
2
- import type { Locale } from 'nuxt-i18n-micro-types';
2
+ import type { Locale } from '@i18n-micro/types';
3
3
  export interface LocaleInfo {
4
4
  current: string;
5
5
  default: string;
@@ -3,7 +3,12 @@ import { useRuntimeConfig } from "#imports";
3
3
  export const useLocaleServerMiddleware = (event, defaultLocale, currentLocale) => {
4
4
  const config = useRuntimeConfig(event);
5
5
  const { locales, defaultLocale: configDefaultLocale, fallbackLocale } = config.public.i18nConfig;
6
- const detectedLocale = currentLocale || detectCurrentLocale(event, { fallbackLocale, defaultLocale: defaultLocale || configDefaultLocale });
6
+ const detectedLocale = currentLocale || detectCurrentLocale(event, {
7
+ fallbackLocale,
8
+ defaultLocale: defaultLocale || configDefaultLocale,
9
+ locales
10
+ // Pass the list of locales
11
+ });
7
12
  const localeConfig = locales?.find((l) => l.code === detectedLocale) ?? null;
8
13
  const availableLocales = locales?.map((l) => l.code) ?? [];
9
14
  const isDefault = detectedLocale === (defaultLocale || configDefaultLocale || "en");
@@ -1,6 +1,6 @@
1
1
  import type { RouteLocationNormalizedLoaded, RouteLocationRaw, RouteLocationResolved, RouteLocationResolvedGeneric, RouteLocationNamedRaw } from 'vue-router';
2
- import { useTranslationHelper } from 'nuxt-i18n-micro-core';
3
- import type { Locale, I18nRouteParams, Params, Translations, CleanTranslation, MissingHandler } from 'nuxt-i18n-micro-types';
2
+ import { useTranslationHelper } from '@i18n-micro/core';
3
+ import type { Locale, I18nRouteParams, Params, Translations, CleanTranslation, MissingHandler } from '@i18n-micro/types';
4
4
  declare const _default: import("nuxt/app").Plugin<{
5
5
  i18n: undefined;
6
6
  __micro: boolean;
@@ -38,8 +38,8 @@ declare const _default: import("nuxt/app").Plugin<{
38
38
  mergeGlobalTranslation(locale: string, newTranslations: Translations, force?: boolean): void;
39
39
  hasGeneralTranslation(locale: string): boolean;
40
40
  hasPageTranslation(locale: string, routeName: string): boolean;
41
- hasTranslation: (locale: string, key: string) => boolean;
42
- getTranslation: <T = unknown>(locale: string, routeName: string, key: string) => T | null;
41
+ hasTranslation: (locale: string, key: import("@i18n-micro/types").TranslationKey) => boolean;
42
+ getTranslation: <T = unknown>(locale: string, routeName: string, key: import("@i18n-micro/types").TranslationKey) => T | null;
43
43
  loadPageTranslations(locale: string, routeName: string, translations: Translations): Promise<void>;
44
44
  loadTranslations(locale: string, translations: Translations): Promise<void>;
45
45
  clearCache(): void;
@@ -81,8 +81,8 @@ declare const _default: import("nuxt/app").Plugin<{
81
81
  mergeGlobalTranslation(locale: string, newTranslations: Translations, force?: boolean): void;
82
82
  hasGeneralTranslation(locale: string): boolean;
83
83
  hasPageTranslation(locale: string, routeName: string): boolean;
84
- hasTranslation: (locale: string, key: string) => boolean;
85
- getTranslation: <T = unknown>(locale: string, routeName: string, key: string) => T | null;
84
+ hasTranslation: (locale: string, key: import("@i18n-micro/types").TranslationKey) => boolean;
85
+ getTranslation: <T = unknown>(locale: string, routeName: string, key: import("@i18n-micro/types").TranslationKey) => T | null;
86
86
  loadPageTranslations(locale: string, routeName: string, translations: Translations): Promise<void>;
87
87
  loadTranslations(locale: string, translations: Translations): Promise<void>;
88
88
  clearCache(): void;
@@ -1,4 +1,4 @@
1
- import { useTranslationHelper, interpolate, isNoPrefixStrategy, RouteService, FormatService } from "nuxt-i18n-micro-core";
1
+ import { useTranslationHelper, interpolate, isNoPrefixStrategy, RouteService, FormatService } from "@i18n-micro/core";
2
2
  import { useRouter, useCookie, navigateTo, defineNuxtPlugin, useRuntimeConfig, createError } from "#imports";
3
3
  import { unref } from "vue";
4
4
  import { useState } from "#app";
@@ -1,4 +1,4 @@
1
- import type { DefineI18nRouteConfig } from 'nuxt-i18n-micro-types';
1
+ import type { DefineI18nRouteConfig } from '@i18n-micro/types';
2
2
  declare const _default: import("nuxt/app").Plugin<{
3
3
  defineI18nRoute: (routeDefinition: DefineI18nRouteConfig) => Promise<void>;
4
4
  }> & import("nuxt/app").ObjectPlugin<{
@@ -1,4 +1,4 @@
1
- import { isPrefixStrategy, isNoPrefixStrategy } from "nuxt-i18n-micro-core";
1
+ import { isPrefixStrategy, isNoPrefixStrategy } from "@i18n-micro/core";
2
2
  import { defineNuxtPlugin, useCookie, useRequestHeaders, navigateTo, useRoute, useRouter } from "#imports";
3
3
  const parseAcceptLanguage = (acceptLanguage) => acceptLanguage.split(",").map((entry) => {
4
4
  const parts = entry.split(";");
@@ -1,4 +1,4 @@
1
- import { isNoPrefixStrategy } from "nuxt-i18n-micro-core";
1
+ import { isNoPrefixStrategy } from "@i18n-micro/core";
2
2
  import { defineNuxtPlugin, useRuntimeConfig, useRouter, useNuxtApp } from "#imports";
3
3
  const isDev = process.env.NODE_ENV !== "production";
4
4
  export default defineNuxtPlugin(async (nuxtApp) => {
@@ -1,4 +1,4 @@
1
- import { isNoPrefixStrategy, isPrefixStrategy } from "nuxt-i18n-micro-core";
1
+ import { isNoPrefixStrategy, isPrefixStrategy } from "@i18n-micro/core";
2
2
  import { defineNuxtPlugin, useRuntimeConfig, useRoute, useRouter, navigateTo, createError } from "#imports";
3
3
  import { findAllowedLocalesForRoute } from "../utils/route-utils.js";
4
4
  import { joinURL, withQuery } from "ufo";
@@ -27,21 +27,21 @@ export default defineNuxtPlugin(async (nuxtApp) => {
27
27
  const defaultLocale = i18nConfig.defaultLocale || "en";
28
28
  const pathSegments = to.path.split("/").filter(Boolean);
29
29
  const firstSegment = pathSegments[0];
30
- const pathWithoutLocale = locales.includes(firstSegment) ? "/" + pathSegments.slice(1).join("/") : to.path;
30
+ const pathWithoutLocale = firstSegment && locales.includes(firstSegment) ? "/" + pathSegments.slice(1).join("/") : to.path;
31
31
  const routeName = (typeof to.name === "string" ? to.name : "").replace("localized-", "").replace(new RegExp(`-(${locales.join("|")})$`), "");
32
32
  const routeRules = globalLocaleRoutes[pathWithoutLocale] || globalLocaleRoutes[routeName];
33
33
  if (routeRules && typeof routeRules === "object") {
34
- const localeToUse = locales.includes(firstSegment) ? firstSegment : defaultLocale;
35
- const customPathSegment = routeRules[localeToUse];
34
+ const localeToUse = firstSegment && locales.includes(firstSegment) ? firstSegment : defaultLocale;
35
+ const customPathSegment = localeToUse ? routeRules[localeToUse] : void 0;
36
36
  if (customPathSegment) {
37
37
  const resolvedCustomPath = resolvePathWithParams(customPathSegment, to.params);
38
- const localizedPath = locales.includes(firstSegment) ? joinURL(`/${firstSegment}`, resolvedCustomPath) : resolvedCustomPath;
38
+ const localizedPath = firstSegment && locales.includes(firstSegment) ? joinURL(`/${firstSegment}`, resolvedCustomPath) : resolvedCustomPath;
39
39
  if (decodeURI(to.path) !== decodeURI(localizedPath)) {
40
40
  const finalUrl = withQuery(localizedPath, to.query);
41
41
  navigateTo(finalUrl, { redirectCode: 301, external: true });
42
42
  return true;
43
43
  }
44
- } else if (locales.includes(firstSegment)) {
44
+ } else if (firstSegment && locales.includes(firstSegment)) {
45
45
  throw createError({ statusCode: 404, statusMessage: "Page Not Found" });
46
46
  }
47
47
  }
@@ -38,8 +38,8 @@ export default defineEventHandler(async (event) => {
38
38
  throw createError({ statusCode: 404 });
39
39
  }
40
40
  let fileLookupPage = page;
41
- if (routesLocaleLinks && routesLocaleLinks[page]) {
42
- fileLookupPage = routesLocaleLinks[page];
41
+ if (routesLocaleLinks && page && routesLocaleLinks[page]) {
42
+ fileLookupPage = routesLocaleLinks[page] || page;
43
43
  if (debug) {
44
44
  console.log(`[i18n] Route link found: '${page}' -> '${fileLookupPage}'. Using linked translations.`);
45
45
  }
@@ -1,3 +1,3 @@
1
1
  import type { H3Event } from 'h3';
2
- import type { Params } from 'nuxt-i18n-micro-types';
2
+ import type { Params } from '@i18n-micro/types';
3
3
  export declare const useTranslationServerMiddleware: (event: H3Event, defaultLocale?: string, currentLocale?: string) => Promise<(key: string, params?: Params, defaultValue?: string) => string>;
@@ -1,4 +1,4 @@
1
- import { interpolate, useTranslationHelper } from "nuxt-i18n-micro-core";
1
+ import { interpolate, useTranslationHelper } from "@i18n-micro/core";
2
2
  import { detectCurrentLocale } from "./utils/locale-detector.js";
3
3
  import { useRuntimeConfig } from "#imports";
4
4
  const I18N_CONTEXT_KEY = "__i18n_cache__";
@@ -30,8 +30,13 @@ export const useTranslationServerMiddleware = async (event, defaultLocale, curre
30
30
  }
31
31
  const requestScopedCache = event.context[I18N_CONTEXT_KEY];
32
32
  const { getTranslation, loadTranslations, hasGeneralTranslation } = useTranslationHelper(requestScopedCache);
33
- const config = useRuntimeConfig(event).i18nConfig;
34
- const locale = currentLocale || detectCurrentLocale(event, config, defaultLocale);
33
+ const config = useRuntimeConfig(event).public.i18nConfig;
34
+ const { locales, fallbackLocale, defaultLocale: configDefaultLocale } = config;
35
+ const locale = currentLocale || detectCurrentLocale(event, {
36
+ fallbackLocale,
37
+ defaultLocale: defaultLocale || configDefaultLocale,
38
+ locales
39
+ }, defaultLocale);
35
40
  if (!hasGeneralTranslation(locale)) {
36
41
  const translations = await fetchTranslations(locale);
37
42
  await loadTranslations(locale, translations);
@@ -5,10 +5,14 @@ import type { H3Event } from 'h3';
5
5
  * @param config - Runtime configuration with i18n settings
6
6
  * @param config.fallbackLocale - Fallback locale from config
7
7
  * @param config.defaultLocale - Default locale from config
8
+ * @param config.locales - List of available locales
8
9
  * @param defaultLocale - Optional default locale override
9
10
  * @returns The detected locale code
10
11
  */
11
12
  export declare const detectCurrentLocale: (event: H3Event, config: {
12
13
  fallbackLocale?: string;
13
14
  defaultLocale?: string;
15
+ locales?: {
16
+ code: string;
17
+ }[];
14
18
  }, defaultLocale?: string) => string;
@@ -1,5 +1,23 @@
1
- import { getQuery, getCookie } from "h3";
1
+ import { getQuery, getCookie, getRequestURL } from "h3";
2
2
  export const detectCurrentLocale = (event, config, defaultLocale) => {
3
- const { fallbackLocale, defaultLocale: configDefaultLocale } = config;
4
- return (event.context.params?.locale || getQuery(event)?.locale || getCookie(event, "user-locale") || event.headers.get("accept-language")?.split(",")[0] || fallbackLocale || defaultLocale || configDefaultLocale || "en").toString();
3
+ const { fallbackLocale, defaultLocale: configDefaultLocale, locales } = config;
4
+ if (event.context.params?.locale) {
5
+ return event.context.params.locale.toString();
6
+ }
7
+ const queryLocale = getQuery(event)?.locale;
8
+ if (queryLocale) {
9
+ return queryLocale.toString();
10
+ }
11
+ if (locales && locales.length > 0) {
12
+ const url = getRequestURL(event);
13
+ const querySplit = url.pathname.split("?");
14
+ const cleanPath = querySplit[0]?.split("#")[0];
15
+ if (!cleanPath) return defaultLocale || "en";
16
+ const pathSegments = cleanPath.split("/").filter(Boolean);
17
+ const firstSegment = pathSegments[0] || "";
18
+ if (firstSegment && locales.some((l) => l.code === firstSegment)) {
19
+ return firstSegment;
20
+ }
21
+ }
22
+ return (getCookie(event, "user-locale") || event.headers.get("accept-language")?.split(",")[0] || fallbackLocale || defaultLocale || configDefaultLocale || "en").toString();
5
23
  };
@@ -9,6 +9,7 @@ export function findAllowedLocalesForRoute(route, routeLocales) {
9
9
  let allowedLocales = routeName && routeLocales?.[routeName] || normalizedRouteName && routeLocales?.[normalizedRouteName] || normalizedRoutePath && routeLocales?.[normalizedRoutePath] || routeLocales?.[routePath];
10
10
  if (!allowedLocales && route.matched && route.matched.length > 0) {
11
11
  const matchedRoute = route.matched[0];
12
+ if (!matchedRoute) return null;
12
13
  const matchedPath = matchedRoute.path;
13
14
  const baseRoutePattern = extractBaseRoutePattern(matchedPath);
14
15
  if (routeLocales?.[baseRoutePattern]) {
@@ -42,6 +43,7 @@ export function isMetaDisabledForRoute(route, routeDisableMeta, currentLocale) {
42
43
  }
43
44
  if (route.matched && route.matched.length > 0) {
44
45
  const matchedRoute = route.matched[0];
46
+ if (!matchedRoute) return false;
45
47
  const matchedPath = matchedRoute.path;
46
48
  const baseRoutePattern = extractBaseRoutePattern(matchedPath);
47
49
  if (checkDisableMeta(routeDisableMeta[baseRoutePattern])) {
package/dist/types.d.mts CHANGED
@@ -4,7 +4,7 @@ declare module '@nuxt/schema' {
4
4
  interface NuxtHooks extends ModuleHooks {}
5
5
  }
6
6
 
7
- export { type Getter, type GlobalLocaleRoutes, type Locale, type LocaleCode, type ModuleOptions, type PluralFunc, type Strategies } from 'nuxt-i18n-micro-types'
7
+ export { type Getter, type GlobalLocaleRoutes, type Locale, type LocaleCode, type ModuleOptions, type PluralFunc, type Strategies } from '@i18n-micro/types'
8
8
 
9
9
  export { type PluginsInjections } from '../dist/runtime/plugins/01.plugin.js'
10
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-i18n-micro",
3
- "version": "2.12.1",
3
+ "version": "2.14.1",
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",
@@ -61,9 +61,9 @@
61
61
  "globby": "^14.1.0",
62
62
  "sirv": "^2.0.4",
63
63
  "ufo": "^1.5.4",
64
- "nuxt-i18n-micro-core": "1.0.25",
65
- "nuxt-i18n-micro-test-utils": "1.0.7",
66
- "nuxt-i18n-micro-types": "1.0.15"
64
+ "@i18n-micro/test-utils": "1.0.7",
65
+ "@i18n-micro/types": "1.0.15",
66
+ "@i18n-micro/core": "1.0.27"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@nuxt/devtools": "^2.6.3",
@@ -93,6 +93,7 @@
93
93
  },
94
94
  "workspaces": [
95
95
  "client",
96
+ "packages/**",
96
97
  "test/fixtures/**/*"
97
98
  ],
98
99
  "scripts": {
@@ -1 +0,0 @@
1
- import{_ as s,c as a,o as i,a as e,t as o}from"./XZXfxmri.js";import{u}from"./CBxwnKtU.js";const l={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},c={class:"max-w-520px text-center"},d=["textContent"],p=["textContent"],f={__name:"error-500",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:500},statusMessage:{type:String,default:"Server error"},description:{type:String,default:"This page is temporarily unavailable."}},setup(t){const r=t;return u({title:`${r.statusCode} - ${r.statusMessage} | ${r.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(g,n)=>(i(),a("div",l,[n[0]||(n[0]=e("div",{class:"-bottom-1/2 fixed h-1/2 left-0 right-0 spotlight"},null,-1)),e("div",c,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:o(t.statusCode)},null,8,d),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:o(t.description)},null,8,p)])]))}},h=s(f,[["__scopeId","data-v-8bb04cde"]]);export{h as default};
@@ -1 +0,0 @@
1
- import{u as a,f as s,h as u,i as r,g as o}from"./XZXfxmri.js";function i(e){const t=e||s();return t?.ssrContext?.head||t?.runWithContext(()=>{if(u())return r(o)})}function x(e,t={}){const n=i(t.nuxt);if(n)return a(e,{head:n,...t})}export{x as u};
@@ -1 +0,0 @@
1
- import{_ as a,c as i,o as u,a as e,t as r,b as c,w as l,d,e as p}from"./XZXfxmri.js";import{u as f}from"./CBxwnKtU.js";const m={class:"antialiased bg-white dark:bg-black dark:text-white font-sans grid min-h-screen overflow-hidden place-content-center text-black"},g={class:"max-w-520px text-center z-20"},h=["textContent"],b=["textContent"],x={class:"flex items-center justify-center w-full"},y={__name:"error-404",props:{appName:{type:String,default:"Nuxt"},version:{type:String,default:""},statusCode:{type:Number,default:404},statusMessage:{type:String,default:"Not Found"},description:{type:String,default:"Sorry, the page you are looking for could not be found."},backHome:{type:String,default:"Go back home"}},setup(t){const n=t;return f({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[{innerHTML:`!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))r(e);new MutationObserver((e=>{for(const o of e)if("childList"===o.type)for(const e of o.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&r(e)})).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;const r=function(e){const r={};return e.integrity&&(r.integrity=e.integrity),e.referrerPolicy&&(r.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?r.credentials="include":"anonymous"===e.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,r)}}();`}],style:[{innerHTML:'*,:after,:before{border-color:var(--un-default-border-color,#e5e7eb);border-style:solid;border-width:0;box-sizing:border-box}:after,:before{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}h1{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}h1,p{margin:0}*,:after,:before{--un-rotate:0;--un-rotate-x:0;--un-rotate-y:0;--un-rotate-z:0;--un-scale-x:1;--un-scale-y:1;--un-scale-z:1;--un-skew-x:0;--un-skew-y:0;--un-translate-x:0;--un-translate-y:0;--un-translate-z:0;--un-pan-x: ;--un-pan-y: ;--un-pinch-zoom: ;--un-scroll-snap-strictness:proximity;--un-ordinal: ;--un-slashed-zero: ;--un-numeric-figure: ;--un-numeric-spacing: ;--un-numeric-fraction: ;--un-border-spacing-x:0;--un-border-spacing-y:0;--un-ring-offset-shadow:0 0 transparent;--un-ring-shadow:0 0 transparent;--un-shadow-inset: ;--un-shadow:0 0 transparent;--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgba(147,197,253,.5);--un-blur: ;--un-brightness: ;--un-contrast: ;--un-drop-shadow: ;--un-grayscale: ;--un-hue-rotate: ;--un-invert: ;--un-saturate: ;--un-sepia: ;--un-backdrop-blur: ;--un-backdrop-brightness: ;--un-backdrop-contrast: ;--un-backdrop-grayscale: ;--un-backdrop-hue-rotate: ;--un-backdrop-invert: ;--un-backdrop-opacity: ;--un-backdrop-saturate: ;--un-backdrop-sepia: }'}]}),(k,o)=>{const s=p;return u(),i("div",m,[o[0]||(o[0]=e("div",{class:"fixed left-0 right-0 spotlight z-10"},null,-1)),e("div",g,[e("h1",{class:"font-medium mb-8 sm:text-10xl text-8xl",textContent:r(t.statusCode)},null,8,h),e("p",{class:"font-light leading-tight mb-16 px-8 sm:px-0 sm:text-4xl text-xl",textContent:r(t.description)},null,8,b),e("div",x,[c(s,{to:"/",class:"cursor-pointer gradient-border px-4 py-2 sm:px-6 sm:py-3 sm:text-xl text-md"},{default:l(()=>[d(r(t.backHome),1)]),_:1})])])])}}},v=a(y,[["__scopeId","data-v-f75a8935"]]);export{v as default};