nuxt-i18n-micro 1.1.16 → 1.3.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.
- package/README.md +71 -17
- package/dist/client/200.html +8 -7
- package/dist/client/404.html +8 -7
- package/dist/client/_nuxt/B6E6ObS_.js +8 -0
- package/dist/client/_nuxt/BfxQCKlw.js +1 -0
- package/dist/client/_nuxt/CdzliWdy.js +1 -0
- package/dist/client/_nuxt/Cnou2wpD.js +127 -0
- package/dist/client/_nuxt/{HZLiFEh-.js → DrEIrqkc.js} +1 -1
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/617ee22e-7535-4912-9e45-dba61630c34c.json +1 -0
- package/dist/client/_nuxt/entry.CF1WZhsD.css +1 -0
- package/dist/client/index.html +8 -7
- package/dist/module.d.mts +10 -4
- package/dist/module.d.ts +10 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +88 -36
- package/dist/runtime/plugins/01.plugin.d.ts +8 -3
- package/dist/runtime/plugins/01.plugin.js +1 -0
- package/dist/runtime/server/middleware/i18n-loader.d.ts +2 -5
- package/dist/runtime/server/middleware/i18n-loader.js +11 -9
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +2 -1
- package/dist/client/_nuxt/6EJ4fAZ2.js +0 -29
- package/dist/client/_nuxt/BdbjBFjr.js +0 -1
- package/dist/client/_nuxt/DdqCv46g.js +0 -1
- package/dist/client/_nuxt/builds/meta/6ca5db61-dc10-4571-98cc-8470d39e285f.json +0 -1
- package/dist/client/_nuxt/entry.BkbVpYOg.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o}from"./
|
|
1
|
+
import{u as o}from"./CdzliWdy.js";import{_ as a,o as s,c as i,a as e,t as r,p as u,f as c}from"./Cnou2wpD.js";const l=t=>(u("data-v-2c66185b"),t=t(),c(),t),d={class:"font-sans antialiased bg-white dark:bg-black text-black dark:text-white grid min-h-screen place-content-center overflow-hidden"},p=l(()=>e("div",{class:"fixed -bottom-1/2 left-0 right-0 h-1/2 spotlight"},null,-1)),h={class:"max-w-520px text-center"},b=["textContent"],g=["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 n=t;return o({title:`${n.statusCode} - ${n.statusMessage} | ${n.appName}`,script:[],style:[{children:'*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:var(--un-default-border-color, #e5e7eb)}:before,:after{--un-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;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;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}h1{font-size:inherit;font-weight:inherit}h1,p{margin:0}*,:before,:after{--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 rgb(0 0 0 / 0);--un-ring-shadow:0 0 rgb(0 0 0 / 0);--un-shadow-inset: ;--un-shadow:0 0 rgb(0 0 0 / 0);--un-ring-inset: ;--un-ring-offset-width:0px;--un-ring-offset-color:#fff;--un-ring-width:0px;--un-ring-color:rgb(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: }'}]}),(m,x)=>(s(),i("div",d,[p,e("div",h,[e("h1",{class:"text-8xl sm:text-10xl font-medium mb-8",textContent:r(t.statusCode)},null,8,b),e("p",{class:"text-xl px-8 sm:px-0 sm:text-4xl font-light mb-16 leading-tight",textContent:r(t.description)},null,8,g)])]))}},w=a(f,[["__scopeId","data-v-2c66185b"]]);export{w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"id":"
|
|
1
|
+
{"id":"617ee22e-7535-4912-9e45-dba61630c34c","timestamp":1724148267155}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"id":"617ee22e-7535-4912-9e45-dba61630c34c","timestamp":1724148267155,"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{bottom:0;content:"";display:block;left:0;position:absolute;right:0;top:0}.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}fieldset,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]{display:none}*,: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: }@font-face{font-display:swap;font-family:DM Mono;font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/dmmono/v14/aFTU7PB1QTsUX8KYthSQBLyM.woff2) format("woff2");unicode-range:u+0100-02af,u+0304,u+0308,u+0329,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/v14/aFTU7PB1QTsUX8KYthqQBA.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+2074,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/v15/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRR232VGM.woff2) format("woff2");unicode-range:u+0100-02af,u+0304,u+0308,u+0329,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/v15/rP2tp2ywxg089UriI5-g4vlH9VoD8CmcqZG40F9JadbnoEwAopxRSW32.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+2074,u+20ac,u+2122,u+2191,u+2193,u+2212,u+2215,u+feff,u+fffd}.carbon-search{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 32 32' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='m29 27.586l-7.552-7.552a11.018 11.018 0 1 0-1.414 1.414L27.586 29ZM4 13a9 9 0 1 1 9 9a9.01 9.01 0 0 1-9-9'/%3E%3C/svg%3E")}.carbon-search,.i-carbon-circle-dash{background-color:currentColor;color:inherit;display:inline-block;height:1.2em;-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;vertical-align:middle;width:1.2em}.i-carbon-circle-dash{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 32 32' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M7.7 4.7a14.7 14.7 0 0 0-3 3.1L6.3 9a13.3 13.3 0 0 1 2.6-2.7zm-3.1 7.6l-1.9-.6A12.5 12.5 0 0 0 2 16h2a11.5 11.5 0 0 1 .6-3.7m-1.9 8.1a14.4 14.4 0 0 0 2 3.9l1.6-1.2a12.9 12.9 0 0 1-1.7-3.3zm5.1 6.9a14.4 14.4 0 0 0 3.9 2l.6-1.9A12.9 12.9 0 0 1 9 25.7zm3.9-24.6l.6 1.9A11.5 11.5 0 0 1 16 4V2a12.5 12.5 0 0 0-4.3.7m12.5 24.6a15.2 15.2 0 0 0 3.1-3.1L25.7 23a11.5 11.5 0 0 1-2.7 2.7zm3.2-7.6l1.9.6A15.5 15.5 0 0 0 30 16h-2a11.5 11.5 0 0 1-.6 3.7m1.8-8.1a14.4 14.4 0 0 0-2-3.9l-1.6 1.2a12.9 12.9 0 0 1 1.7 3.3zm-5.1-7a14.4 14.4 0 0 0-3.9-2l-.6 1.9a12.9 12.9 0 0 1 3.3 1.7zm-3.8 24.7l-.6-1.9a11.5 11.5 0 0 1-3.7.6v2a21.4 21.4 0 0 0 4.3-.7'/%3E%3C/svg%3E")}.i-carbon\:arrow-up-right,[i-carbon\:arrow-up-right=""]{--un-icon:url("data:image/svg+xml;utf8,%3Csvg viewBox='0 0 32 32' display='inline-block' vertical-align='middle' width='1.2em' height='1.2em' xmlns='http://www.w3.org/2000/svg' %3E%3Cpath fill='currentColor' d='M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6z'/%3E%3C/svg%3E");background-color:currentColor;color:inherit;display:inline-block;height:1.2em;-webkit-mask:var(--un-icon) no-repeat;mask:var(--un-icon) no-repeat;-webkit-mask-size:100% 100%;mask-size:100% 100%;vertical-align:middle;width:1.2em}.n-loading{width:100%}.n-loading,.n-panel-grids-center{align-items:center;display:flex;height:100%;justify-content:center}.n-panel-grids-center{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' transform='scale(3)'%3E%3Crect width='100%25' height='100%25' fill='%23fff'/%3E%3Cpath fill='none' stroke='hsla(0, 0%25, 98%25, 1)' stroke-width='.2' d='M10 0v20ZM0 10h20Z'/%3E%3C/svg%3E");background-size:40px 40px;flex-direction:column;gap:.5rem}.n-icon{flex:none}.n-card-base{border-color:#9ca3af33;border-radius:.25rem;border-width:1px;--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity));--un-shadow:var(--un-shadow-inset) 0 1px 2px 0 var(--un-shadow-color,rgba(0,0,0,.05));box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow)}.n-border-base{border-color:#9ca3af33}.n-bg-active{background-color:#9ca3af0d}.dark .n-bg-base,.dark .n-card-base{--un-bg-opacity:1;background-color:rgb(21 21 21/var(--un-bg-opacity))}.n-bg-base{--un-bg-opacity:1;background-color:rgb(255 255 255/var(--un-bg-opacity))}.hover\:n-bg-hover:hover{background-color:#9ca3af08}.hover\:n-link-hover:hover{--un-text-opacity:1;color:rgba(var(--nui-c-context),var(--un-text-opacity));-webkit-text-decoration-color:rgba(var(--nui-c-context),var(--un-line-opacity))!important;--un-line-opacity:1!important;opacity:1!important;text-decoration-color:rgba(var(--nui-c-context),var(--un-line-opacity))!important;text-decoration-style:dotted}.n-link-base{text-decoration-color:#0003;text-decoration-line:underline;text-underline-offset:2px}.dark .n-link-base{text-decoration-color:#fff6}.focus-within\:n-focus-base:focus-within{--un-ring-width:2px;--un-ring-offset-shadow:var(--un-ring-inset) 0 0 0 var(--un-ring-offset-width) var(--un-ring-offset-color);--un-ring-shadow:var(--un-ring-inset) 0 0 0 calc(var(--un-ring-width) + var(--un-ring-offset-width)) var(--un-ring-color);box-shadow:var(--un-ring-offset-shadow),var(--un-ring-shadow),var(--un-shadow);--un-ring-color:rgba(var(--nui-c-context),.5)}.n-transition{transition-duration:.15s;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.dark .n-panel-grids-center{background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' transform='scale(3)'%3E%3Crect width='100%25' height='100%25' fill='hsl(0, 0%25, 8.5%25)'/%3E%3Cpath fill='none' stroke='hsl(0, 0%25, 11.0%25)' stroke-width='.2' d='M10 0v20ZM0 10h20Z'/%3E%3C/svg%3E");background-size:40px 40px}.absolute{position:absolute}.fixed{position:fixed}.relative,[relative=""]{position:relative}.-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}.ml-0\.3em{margin-left:.3em}.ml-0\.4em{margin-left:.4em}.mr-0\.1em{margin-right:.1em}.block,[block=""]{display:block}.h-1\/2{height:50%}.h-auto{height:auto}.h-full,[h-full=""]{height:100%}.h-screen{height:100vh}.h1{height:.25rem}.max-w-520px{max-width:520px}.min-h-screen{min-height:100vh}.w-full,[w-full=""]{width:100%}.flex,[flex~="~"]{display:flex}.flex-1{flex:1 1 0%}.flex-auto{flex:1 1 auto}.flex-col,[flex~=col]{flex-direction:column}.translate-y--1,[translate-y--1=""]{--un-translate-y:-.25rem;transform:translate(var(--un-translate-x)) translateY(var(--un-translate-y)) translateZ(var(--un-translate-z)) rotate(var(--un-rotate)) rotateX(var(--un-rotate-x)) rotateY(var(--un-rotate-y)) rotate(var(--un-rotate-z)) skew(var(--un-skew-x)) skewY(var(--un-skew-y)) scaleX(var(--un-scale-x)) scaleY(var(--un-scale-y)) scaleZ(var(--un-scale-z))}@keyframes pulse{0%,to{opacity:1}50%{opacity:.5}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.place-content-center{place-content:center}.items-center{align-items:center}.justify-center{justify-content:center}.of-auto\!{overflow:auto!important}.of-hidden,.overflow-hidden,[of-hidden=""]{overflow:hidden}.overflow-auto{overflow:auto}.overflow-y-auto{overflow-y:auto}.truncate,[truncate=""]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.border{border-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.focus-within\:border-context:focus-within{--un-border-opacity:1;border-color:rgba(var(--nui-c-context),var(--un-border-opacity))}.rounded{border-radius:.25rem}.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}.px2,[px2=""]{padding-left:.5rem;padding-right:.5rem}.px6,[px6=""]{padding-left:1.5rem;padding-right:1.5rem}.py-1,.py1,[py1=""]{padding-bottom:.25rem;padding-top:.25rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py4,[py4=""]{padding-bottom:1rem;padding-top:1rem}.pl-1{padding-left:.25rem}.pr-2{padding-right:.5rem}.pt-14{padding-top:3.5rem}.text-center{text-align:center}.text-start,[text-start=""]{text-align:start}.text-1\.1em{font-size:1.1em}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-6xl{font-size:3.75rem;line-height:1}.text-8xl{font-size:6rem;line-height:1}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm,[text-sm=""]{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs,[text-xs=""]{font-size:.75rem;line-height:1rem}.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))}.text-primary{--un-text-opacity:1;color:rgb(9 158 97/var(--un-text-opacity))}.font-light{font-weight:300}.font-medium{font-weight:500}.leading-tight{line-height:1.25}.font-mono,[font-mono=""]{font-family:DM Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.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}.underline,[underline=""]{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.op50,[op50=""]{opacity:.5}.\!outline-none{outline:2px solid transparent!important;outline-offset:2px!important}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease,.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}[n~=orange]{--nui-c-context:251,146,60}@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}}.splitpanes{display:flex;height:100%;width:100%}.splitpanes--vertical{flex-direction:row}.splitpanes--horizontal{flex-direction:column}.splitpanes--dragging *{-webkit-user-select:none;-moz-user-select:none;user-select:none}.splitpanes__pane{height:100%;overflow:hidden;width:100%}.splitpanes--vertical .splitpanes__pane{transition:width .2s ease-out}.splitpanes--horizontal .splitpanes__pane{transition:height .2s ease-out}.splitpanes--dragging .splitpanes__pane{transition:none}.splitpanes__splitter{touch-action:none}.splitpanes--vertical>.splitpanes__splitter{cursor:col-resize;min-width:1px}.splitpanes--horizontal>.splitpanes__splitter{cursor:row-resize;min-height:1px}.splitpanes.default-theme .splitpanes__pane{background-color:#f2f2f2}.splitpanes.default-theme .splitpanes__splitter{background-color:#fff;box-sizing:border-box;flex-shrink:0;position:relative}.splitpanes.default-theme .splitpanes__splitter:after,.splitpanes.default-theme .splitpanes__splitter:before{background-color:#00000026;content:"";left:50%;position:absolute;top:50%;transition:background-color .3s}.splitpanes.default-theme .splitpanes__splitter:hover:after,.splitpanes.default-theme .splitpanes__splitter:hover:before{background-color:#00000040}.splitpanes.default-theme .splitpanes__splitter:first-child{cursor:auto}.default-theme.splitpanes .splitpanes .splitpanes__splitter{z-index:1}.default-theme .splitpanes--vertical>.splitpanes__splitter,.default-theme.splitpanes--vertical>.splitpanes__splitter{border-left:1px solid #eee;margin-left:-1px;width:7px}.default-theme .splitpanes--vertical>.splitpanes__splitter:after,.default-theme .splitpanes--vertical>.splitpanes__splitter:before,.default-theme.splitpanes--vertical>.splitpanes__splitter:after,.default-theme.splitpanes--vertical>.splitpanes__splitter:before{height:30px;transform:translateY(-50%);width:1px}.default-theme .splitpanes--vertical>.splitpanes__splitter:before,.default-theme.splitpanes--vertical>.splitpanes__splitter:before{margin-left:-2px}.default-theme .splitpanes--vertical>.splitpanes__splitter:after,.default-theme.splitpanes--vertical>.splitpanes__splitter:after{margin-left:1px}.default-theme .splitpanes--horizontal>.splitpanes__splitter,.default-theme.splitpanes--horizontal>.splitpanes__splitter{border-top:1px solid #eee;height:7px;margin-top:-1px}.default-theme .splitpanes--horizontal>.splitpanes__splitter:after,.default-theme .splitpanes--horizontal>.splitpanes__splitter:before,.default-theme.splitpanes--horizontal>.splitpanes__splitter:after,.default-theme.splitpanes--horizontal>.splitpanes__splitter:before{height:1px;transform:translate(-50%);width:30px}.default-theme .splitpanes--horizontal>.splitpanes__splitter:before,.default-theme.splitpanes--horizontal>.splitpanes__splitter:before{margin-top:-2px}.default-theme .splitpanes--horizontal>.splitpanes__splitter:after,.default-theme.splitpanes--horizontal>.splitpanes__splitter:after{margin-top:1px}.splitpanes__splitter{position:relative}.splitpanes__splitter:before{content:"";left:0;position:absolute;top:0;transition:.2s ease;transition:opacity .4s;z-index:1}.splitpanes__splitter:hover:before{background:#8881;opacity:1}.splitpanes--vertical>.splitpanes__splitter{min-width:0!important;width:0!important;border-right-width:1px}.splitpanes--horizontal>.splitpanes__splitter{height:0!important;min-height:0!important;border-top-width:1px}.splitpanes--vertical>.splitpanes__splitter:before{height:100%;left:-5px;right:-4px}.splitpanes--horizontal>.splitpanes__splitter:before{bottom:-4px;top:-5px;width:100%}
|
package/dist/client/index.html
CHANGED
|
@@ -1,11 +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
|
-
<link rel="stylesheet" href="/__nuxt-i18n-micro/_nuxt/entry.
|
|
4
|
-
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
3
|
+
<link rel="stylesheet" href="/__nuxt-i18n-micro/_nuxt/entry.CF1WZhsD.css">
|
|
4
|
+
<link rel="modulepreload" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/Cnou2wpD.js">
|
|
5
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/B6E6ObS_.js">
|
|
5
6
|
<link rel="prefetch" as="style" href="/__nuxt-i18n-micro/_nuxt/error-404.CjTTbIxB.css">
|
|
6
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
7
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
7
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/BfxQCKlw.js">
|
|
8
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/CdzliWdy.js">
|
|
8
9
|
<link rel="prefetch" as="style" href="/__nuxt-i18n-micro/_nuxt/error-500.B4KzowuE.css">
|
|
9
|
-
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/
|
|
10
|
-
<script type="module" src="/__nuxt-i18n-micro/_nuxt/
|
|
11
|
-
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"
|
|
10
|
+
<link rel="prefetch" as="script" crossorigin href="/__nuxt-i18n-micro/_nuxt/DrEIrqkc.js">
|
|
11
|
+
<script type="module" src="/__nuxt-i18n-micro/_nuxt/Cnou2wpD.js" crossorigin></script></head><body><div id="__nuxt"></div><div id="teleports"></div><script type="application/json" id="__NUXT_DATA__" data-ssr="false">[{"serverRendered":1},false]</script>
|
|
12
|
+
<script>window.__NUXT__={};window.__NUXT__.config={public:{},app:{baseURL:"/__nuxt-i18n-micro",buildId:"617ee22e-7535-4912-9e45-dba61630c34c",buildAssetsDir:"/_nuxt/",cdnURL:""}}</script></body></html>
|
package/dist/module.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { HookResult } from '@nuxt/schema';
|
|
|
3
3
|
|
|
4
4
|
interface Locale {
|
|
5
5
|
code: string;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
iso?: string;
|
|
7
8
|
dir?: 'rtl' | 'ltr';
|
|
8
9
|
}
|
|
@@ -16,6 +17,11 @@ interface ModuleOptions {
|
|
|
16
17
|
cache?: boolean;
|
|
17
18
|
plural?: string;
|
|
18
19
|
}
|
|
20
|
+
interface ModuleOptionsExtend extends ModuleOptions {
|
|
21
|
+
rootDir: string;
|
|
22
|
+
pluralString: string;
|
|
23
|
+
rootDirs: string[];
|
|
24
|
+
}
|
|
19
25
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
20
26
|
|
|
21
27
|
interface ModuleHooks {
|
|
@@ -24,14 +30,14 @@ interface ModuleHooks {
|
|
|
24
30
|
declare module '@nuxt/schema' {
|
|
25
31
|
interface ConfigSchema {
|
|
26
32
|
publicRuntimeConfig?: {
|
|
27
|
-
i18nConfig?:
|
|
33
|
+
i18nConfig?: ModuleOptionsExtend;
|
|
28
34
|
};
|
|
29
35
|
}
|
|
30
36
|
interface NuxtConfig {
|
|
31
|
-
i18nConfig?:
|
|
37
|
+
i18nConfig?: ModuleOptionsExtend;
|
|
32
38
|
}
|
|
33
39
|
interface NuxtOptions {
|
|
34
|
-
i18nConfig?:
|
|
40
|
+
i18nConfig?: ModuleOptionsExtend;
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
43
|
declare module '@nuxt/schema' {
|
|
@@ -39,4 +45,4 @@ declare module '@nuxt/schema' {
|
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
export { type Locale, type ModuleHooks, type ModuleOptions, _default as default };
|
|
48
|
+
export { type Locale, type ModuleHooks, type ModuleOptions, type ModuleOptionsExtend, _default as default };
|
package/dist/module.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { HookResult } from '@nuxt/schema';
|
|
|
3
3
|
|
|
4
4
|
interface Locale {
|
|
5
5
|
code: string;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
iso?: string;
|
|
7
8
|
dir?: 'rtl' | 'ltr';
|
|
8
9
|
}
|
|
@@ -16,6 +17,11 @@ interface ModuleOptions {
|
|
|
16
17
|
cache?: boolean;
|
|
17
18
|
plural?: string;
|
|
18
19
|
}
|
|
20
|
+
interface ModuleOptionsExtend extends ModuleOptions {
|
|
21
|
+
rootDir: string;
|
|
22
|
+
pluralString: string;
|
|
23
|
+
rootDirs: string[];
|
|
24
|
+
}
|
|
19
25
|
declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
|
|
20
26
|
|
|
21
27
|
interface ModuleHooks {
|
|
@@ -24,14 +30,14 @@ interface ModuleHooks {
|
|
|
24
30
|
declare module '@nuxt/schema' {
|
|
25
31
|
interface ConfigSchema {
|
|
26
32
|
publicRuntimeConfig?: {
|
|
27
|
-
i18nConfig?:
|
|
33
|
+
i18nConfig?: ModuleOptionsExtend;
|
|
28
34
|
};
|
|
29
35
|
}
|
|
30
36
|
interface NuxtConfig {
|
|
31
|
-
i18nConfig?:
|
|
37
|
+
i18nConfig?: ModuleOptionsExtend;
|
|
32
38
|
}
|
|
33
39
|
interface NuxtOptions {
|
|
34
|
-
i18nConfig?:
|
|
40
|
+
i18nConfig?: ModuleOptionsExtend;
|
|
35
41
|
}
|
|
36
42
|
}
|
|
37
43
|
declare module '@nuxt/schema' {
|
|
@@ -39,4 +45,4 @@ declare module '@nuxt/schema' {
|
|
|
39
45
|
}
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
export { type Locale, type ModuleHooks, type ModuleOptions, _default as default };
|
|
48
|
+
export { type Locale, type ModuleHooks, type ModuleOptions, type ModuleOptionsExtend, _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
4
4
|
import { useNuxt, defineNuxtModule, createResolver, addPlugin, addImportsDir, addServerHandler, addComponentsDir, extendPages, addPrerenderRoutes } from '@nuxt/kit';
|
|
5
|
+
import { watch } from 'chokidar';
|
|
5
6
|
import { onDevToolsInitialized, extendServerRpc } from '@nuxt/devtools-kit';
|
|
6
7
|
|
|
7
8
|
const DEVTOOLS_UI_PORT = 3030;
|
|
@@ -29,29 +30,48 @@ function setupDevToolsUI(options, resolve) {
|
|
|
29
30
|
}
|
|
30
31
|
onDevToolsInitialized(async () => {
|
|
31
32
|
extendServerRpc("nuxt-i18n-micro", {
|
|
33
|
+
async saveTranslationContent(locale, file, content) {
|
|
34
|
+
const filePath = path.resolve(file);
|
|
35
|
+
if (fs.existsSync(filePath)) {
|
|
36
|
+
fs.writeFileSync(filePath, JSON.stringify(content, null, 2), "utf-8");
|
|
37
|
+
} else {
|
|
38
|
+
throw new Error(`File not found: ${filePath}`);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
32
41
|
async getLocalesAndTranslations() {
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
const rootDirs = nuxt.options.runtimeConfig.public.i18nConfig?.rootDirs || [nuxt.options.rootDir];
|
|
43
|
+
const localesData = [];
|
|
44
|
+
for (const rootDir of rootDirs) {
|
|
45
|
+
const localesDir = path.join(rootDir, options.translationDir || "locales");
|
|
46
|
+
const pagesDir = path.join(rootDir, options.translationDir || "locales", "pages");
|
|
47
|
+
if (!fs.existsSync(localesDir))
|
|
48
|
+
continue;
|
|
49
|
+
const localeFiles = fs.readdirSync(localesDir);
|
|
50
|
+
const pageDirs = fs.existsSync(pagesDir) ? fs.readdirSync(pagesDir).filter((file) => fs.lstatSync(path.join(pagesDir, file)).isDirectory()) : [];
|
|
51
|
+
const locales = options.locales?.map((locale) => locale.code) || [];
|
|
52
|
+
locales.forEach((locale) => {
|
|
53
|
+
const localeData = localesData.find((data) => data.locale === locale);
|
|
54
|
+
const files = localeFiles.filter((file) => file.startsWith(locale)).map((file) => path.join(localesDir, file));
|
|
55
|
+
const content = localeData?.content || {};
|
|
56
|
+
files.forEach((filePath) => {
|
|
57
|
+
content[filePath] = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
58
|
+
});
|
|
59
|
+
pageDirs.forEach((dir) => {
|
|
60
|
+
const pageLocaleFilePath = path.join(pagesDir, dir, `${locale}.json`);
|
|
61
|
+
if (fs.existsSync(pageLocaleFilePath)) {
|
|
62
|
+
content[pageLocaleFilePath] = JSON.parse(fs.readFileSync(pageLocaleFilePath, "utf-8"));
|
|
63
|
+
files.push(pageLocaleFilePath);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if (localeData) {
|
|
67
|
+
localeData.files.push(...files);
|
|
68
|
+
localeData.content = { ...localeData.content, ...content };
|
|
69
|
+
} else {
|
|
70
|
+
localesData.push({ locale, files, content });
|
|
51
71
|
}
|
|
52
72
|
});
|
|
53
|
-
|
|
54
|
-
|
|
73
|
+
}
|
|
74
|
+
return localesData;
|
|
55
75
|
}
|
|
56
76
|
});
|
|
57
77
|
nuxt.hook("devtools:customTabs", (tabs) => {
|
|
@@ -95,10 +115,21 @@ const module = defineNuxtModule({
|
|
|
95
115
|
},
|
|
96
116
|
setup: async function(options, nuxt) {
|
|
97
117
|
const resolver = createResolver(import.meta.url);
|
|
118
|
+
const rootDirs = nuxt.options._layers.map((layer) => layer.config.rootDir).reverse();
|
|
119
|
+
const locales = (options.locales ?? []).reduce((acc, locale) => {
|
|
120
|
+
const existingLocale = acc.find((l) => l.code === locale.code);
|
|
121
|
+
if (existingLocale) {
|
|
122
|
+
Object.assign(existingLocale, locale);
|
|
123
|
+
} else {
|
|
124
|
+
acc.push(locale);
|
|
125
|
+
}
|
|
126
|
+
return acc;
|
|
127
|
+
}, []).filter((locale) => !locale.disabled);
|
|
98
128
|
nuxt.options.runtimeConfig.public.i18nConfig = {
|
|
99
129
|
rootDir: nuxt.options.rootDir,
|
|
130
|
+
rootDirs,
|
|
100
131
|
plural: options.plural,
|
|
101
|
-
locales:
|
|
132
|
+
locales: locales ?? [],
|
|
102
133
|
mata: options.mata ?? true,
|
|
103
134
|
defaultLocale: options.defaultLocale ?? "en",
|
|
104
135
|
translationDir: options.translationDir ?? "locales",
|
|
@@ -143,23 +174,28 @@ const module = defineNuxtModule({
|
|
|
143
174
|
pathPrefix: false,
|
|
144
175
|
extensions: ["vue"]
|
|
145
176
|
});
|
|
146
|
-
const localeRegex =
|
|
177
|
+
const localeRegex = locales.filter((locale) => locale.code !== options.defaultLocale || options.includeDefaultLocaleRoute).map((locale) => locale.code).join("|");
|
|
147
178
|
const pagesDir = path.resolve(nuxt.options.rootDir, options.translationDir, "pages");
|
|
148
179
|
extendPages((pages) => {
|
|
149
180
|
const pagesNames = pages.map((page) => page.name);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
181
|
+
function ensureFileExists(filePath) {
|
|
182
|
+
const fileDir = path.dirname(filePath);
|
|
183
|
+
if (!existsSync(fileDir)) {
|
|
184
|
+
mkdirSync(fileDir, { recursive: true });
|
|
185
|
+
}
|
|
186
|
+
if (!existsSync(filePath)) {
|
|
187
|
+
writeFileSync(filePath, JSON.stringify({}), "utf-8");
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
locales.forEach((locale) => {
|
|
191
|
+
const globalFilePath = path.join(nuxt.options.rootDir, options.translationDir, `${locale.code}.json`);
|
|
192
|
+
ensureFileExists(globalFilePath);
|
|
193
|
+
pages.forEach((page) => {
|
|
194
|
+
const pageFilePath = path.join(pagesDir, `${page.name}/${locale.code}.json`);
|
|
195
|
+
ensureFileExists(pageFilePath);
|
|
162
196
|
});
|
|
197
|
+
});
|
|
198
|
+
const newRoutes = pages.map((page) => {
|
|
163
199
|
return {
|
|
164
200
|
...page,
|
|
165
201
|
path: `/:locale(${localeRegex})${page.path}`,
|
|
@@ -171,7 +207,7 @@ const module = defineNuxtModule({
|
|
|
171
207
|
});
|
|
172
208
|
pages.push(...newRoutes);
|
|
173
209
|
nuxt.options.generate.routes = Array.isArray(nuxt.options.generate.routes) ? nuxt.options.generate.routes : [];
|
|
174
|
-
|
|
210
|
+
locales.forEach((locale) => {
|
|
175
211
|
pagesNames.forEach((name) => {
|
|
176
212
|
addPrerenderRoutes(`/_locales/${name}/${locale.code}/data.json`);
|
|
177
213
|
});
|
|
@@ -182,7 +218,7 @@ const module = defineNuxtModule({
|
|
|
182
218
|
const routes = nitroConfig.prerender?.routes || [];
|
|
183
219
|
nuxt.options.generate.routes = Array.isArray(nuxt.options.generate.routes) ? nuxt.options.generate.routes : [];
|
|
184
220
|
const pages = nuxt.options.generate.routes || [];
|
|
185
|
-
|
|
221
|
+
locales.forEach((locale) => {
|
|
186
222
|
if (locale.code !== options.defaultLocale || options.includeDefaultLocaleRoute) {
|
|
187
223
|
pages.forEach((page) => {
|
|
188
224
|
routes.push(`/${locale.code}${page}`);
|
|
@@ -192,6 +228,22 @@ const module = defineNuxtModule({
|
|
|
192
228
|
nitroConfig.prerender = nitroConfig.prerender || {};
|
|
193
229
|
nitroConfig.prerender.routes = routes;
|
|
194
230
|
});
|
|
231
|
+
nuxt.hook("nitro:build:before", async (_nitro) => {
|
|
232
|
+
const isProd = nuxt.options.dev === false;
|
|
233
|
+
if (!isProd) {
|
|
234
|
+
const translationPath = path.resolve(nuxt.options.rootDir, options.translationDir);
|
|
235
|
+
console.log("\u2139 add file watcher", translationPath);
|
|
236
|
+
const watcherEvent = async (path2) => {
|
|
237
|
+
watcher.close();
|
|
238
|
+
console.log("\u21BB update store item", path2);
|
|
239
|
+
nuxt.callHook("restart");
|
|
240
|
+
};
|
|
241
|
+
const watcher = watch(translationPath, { depth: 1, persistent: true }).on("change", watcherEvent);
|
|
242
|
+
nuxt.hook("close", () => {
|
|
243
|
+
watcher.close();
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
});
|
|
195
247
|
if (nuxt.options.dev) {
|
|
196
248
|
setupDevToolsUI(options, resolver.resolve);
|
|
197
249
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RouteLocationRaw } from 'vue-router';
|
|
2
|
+
import type { Locale } from '../../module.js';
|
|
2
3
|
export interface Translations {
|
|
3
4
|
[key: string]: string | number | boolean | Translations | PluralTranslations | unknown[] | null;
|
|
4
5
|
}
|
|
@@ -8,7 +9,7 @@ interface PluralTranslations {
|
|
|
8
9
|
}
|
|
9
10
|
declare const _default: import("#app").Plugin<{
|
|
10
11
|
getLocale: () => string;
|
|
11
|
-
getLocales: () =>
|
|
12
|
+
getLocales: () => Locale[];
|
|
12
13
|
t: <T extends Record<string, string | number | boolean>>(key: string, params?: T, defaultValue?: string) => string | number | boolean | Translations | PluralTranslations | unknown[] | unknown | null;
|
|
13
14
|
tc: (key: string, count: number, defaultValue?: string) => string;
|
|
14
15
|
has: (key: string) => boolean;
|
|
@@ -17,7 +18,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
17
18
|
localeRoute: (to: RouteLocationRaw, locale?: string) => RouteLocationRaw;
|
|
18
19
|
}> & import("#app").ObjectPlugin<{
|
|
19
20
|
getLocale: () => string;
|
|
20
|
-
getLocales: () =>
|
|
21
|
+
getLocales: () => Locale[];
|
|
21
22
|
t: <T extends Record<string, string | number | boolean>>(key: string, params?: T, defaultValue?: string) => string | number | boolean | Translations | PluralTranslations | unknown[] | unknown | null;
|
|
22
23
|
tc: (key: string, count: number, defaultValue?: string) => string;
|
|
23
24
|
has: (key: string) => boolean;
|
|
@@ -28,7 +29,7 @@ declare const _default: import("#app").Plugin<{
|
|
|
28
29
|
export default _default;
|
|
29
30
|
export interface PluginsInjections {
|
|
30
31
|
$getLocale: () => string;
|
|
31
|
-
$getLocales: () =>
|
|
32
|
+
$getLocales: () => Locale[];
|
|
32
33
|
$t: <T extends Record<string, string | number | boolean>>(key: string, params?: T, defaultValue?: string) => string | number | boolean | Translations | PluralTranslations | unknown[] | unknown | null;
|
|
33
34
|
$tc: (key: string, count: number, defaultValue?: string) => string;
|
|
34
35
|
$has: (key: string) => boolean;
|
|
@@ -41,6 +42,10 @@ declare module '#app' {
|
|
|
41
42
|
interface NuxtApp extends PluginsInjections {
|
|
42
43
|
}
|
|
43
44
|
}
|
|
45
|
+
declare module '@vue/runtime-core' {
|
|
46
|
+
interface ComponentCustomProperties extends PluginsInjections {
|
|
47
|
+
}
|
|
48
|
+
}
|
|
44
49
|
declare module 'nuxt/dist/app/nuxt' {
|
|
45
50
|
interface NuxtApp extends PluginsInjections {
|
|
46
51
|
}
|
|
@@ -106,6 +106,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
106
106
|
let value = i18nHelper.getTranslation(locale, routeName, key, !!i18nConfig.cache);
|
|
107
107
|
if (!value) {
|
|
108
108
|
if (isDev && import.meta.client) {
|
|
109
|
+
console.warn(`Not found '${key}' key in '${locale}' locale messages.`);
|
|
109
110
|
}
|
|
110
111
|
value = defaultValue || key;
|
|
111
112
|
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
rootDir?: string;
|
|
4
|
-
}
|
|
5
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<any>>;
|
|
1
|
+
import type { Translations } from '../../plugins/01.plugin.js';
|
|
2
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<Translations>>;
|
|
6
3
|
export default _default;
|
|
@@ -5,18 +5,20 @@ import { useRuntimeConfig } from "#imports";
|
|
|
5
5
|
export default defineEventHandler(async (event) => {
|
|
6
6
|
const { page, locale } = event.context.params;
|
|
7
7
|
const config = useRuntimeConfig();
|
|
8
|
-
const {
|
|
8
|
+
const { rootDirs, translationDir } = config.public.i18nConfig;
|
|
9
9
|
let path = `${locale}.json`;
|
|
10
10
|
if (page !== "general") {
|
|
11
11
|
path = `pages/${page}/${locale}.json`;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
let translations = {};
|
|
14
|
+
for (const i in rootDirs) {
|
|
15
|
+
const translationPath = resolve(rootDirs[i], translationDir, path);
|
|
16
|
+
try {
|
|
17
|
+
const fileContent = await readFile(translationPath, "utf-8");
|
|
18
|
+
const content = JSON.parse(fileContent);
|
|
19
|
+
translations = { ...translations, ...content };
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
21
22
|
}
|
|
23
|
+
return translations;
|
|
22
24
|
});
|
package/dist/types.d.mts
CHANGED
|
@@ -8,4 +8,4 @@ declare module 'nuxt/schema' {
|
|
|
8
8
|
interface NuxtHooks extends ModuleHooks {}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export { type Locale, type ModuleHooks, type ModuleOptions, default } from './module.js'
|
|
11
|
+
export { type Locale, type ModuleHooks, type ModuleOptions, type ModuleOptionsExtend, default } from './module.js'
|
package/dist/types.d.ts
CHANGED
|
@@ -8,4 +8,4 @@ declare module 'nuxt/schema' {
|
|
|
8
8
|
interface NuxtHooks extends ModuleHooks {}
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export { type Locale, type ModuleHooks, type ModuleOptions, default } from './module'
|
|
11
|
+
export { type Locale, type ModuleHooks, type ModuleOptions, type ModuleOptionsExtend, default } from './module'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-i18n-micro",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@nuxt/devtools-kit": "^1.3.9",
|
|
59
59
|
"@nuxt/kit": "^3.12.4",
|
|
60
|
+
"chokidar": "^3.6.0",
|
|
60
61
|
"sirv": "^2.0.4"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|