@i18n-micro/vue 1.3.3 → 1.3.6
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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -6
- package/dist/index.d.ts +30 -6
- package/dist/index.mjs +320 -279
- package/dist/index.mjs.map +1 -1
- package/package.json +35 -37
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),U=require("@i18n-micro/core"),Y=require("vue-router"),T=Symbol("i18n"),V=Symbol("i18n-locales"),F=Symbol("i18n-default-locale"),A=Symbol("i18n-router-strategy"),z=a.defineComponent({name:"I18nGroup",props:{prefix:{type:String,required:!0},groupClass:{type:String,default:""}},setup(t,{slots:e}){const r=a.inject(T);if(!r)throw new Error("[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.");const o=(u,l)=>r.t(`${t.prefix}.${u}`,l,void 0,r.getRoute());return()=>a.h("div",{class:["i18n-group",t.groupClass]},e.default?.({prefix:t.prefix,t:o}))}}),G=a.defineComponent({name:"I18nLink",props:{to:{type:[String,Object],required:!0},activeStyle:{type:Object,default:()=>({})},localeRoute:{type:Function,default:void 0}},setup(t,{slots:e}){const r=a.inject(T),o=a.inject(A,void 0);if(!r)throw new Error("[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.");const u=a.computed(()=>typeof t.to=="string"?/^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(t.to):!1),l=a.computed(()=>{if(u.value)return t.to;if(t.localeRoute){const n=t.localeRoute(t.to);return typeof n=="string"?n:n.path||"/"}if(!o?.resolvePath)return typeof t.to=="string"?t.to:t.to.path||"/";const i=o.resolvePath(t.to,r.locale.value);return typeof i=="string"?i:i.path||"/"}),d=a.computed(()=>{if(u.value||!o)return!1;const i=o.getCurrentPath().replace(/\/$/,""),n=l.value.replace(/\/$/,"");return i===n}),h=a.computed(()=>d.value?t.activeStyle:{});return()=>u.value?a.h("a",{href:l.value,target:"_blank",rel:"noopener noreferrer",style:h.value},e.default?.()):o?.linkComponent?a.h(o.linkComponent,{to:l.value,style:h.value},{default:e.default}):a.h("a",{href:l.value,style:h.value,onClick:i=>{i.preventDefault(),o?o.push({path:l.value}):window.location.href=l.value}},e.default?.())}}),Z=a.defineComponent({name:"I18nSwitcher",props:{customLabels:{type:Object,default:()=>({})},customWrapperStyle:{type:Object,default:()=>({})},customButtonStyle:{type:Object,default:()=>({})},customDropdownStyle:{type:Object,default:()=>({})},customItemStyle:{type:Object,default:()=>({})},customLinkStyle:{type:Object,default:()=>({})},customActiveLinkStyle:{type:Object,default:()=>({})},customDisabledLinkStyle:{type:Object,default:()=>({})},customIconStyle:{type:Object,default:()=>({})},locales:{type:Array,default:void 0},currentLocale:{type:[String,Function],default:void 0},getLocaleName:{type:Function,default:void 0},switchLocale:{type:Function,default:void 0},localeRoute:{type:Function,default:void 0}},setup(t,{slots:e}){const r=a.inject(T),o=a.inject(A,void 0),u=a.inject(V,void 0);if(!r)throw new Error("[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.");if(!u&&!t.locales)throw new Error("[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.");const l=a.computed(()=>t.locales||u||[]),d=a.computed(()=>t.currentLocale!==void 0?typeof t.currentLocale=="function"?t.currentLocale():t.currentLocale:r.locale.value),h=a.computed(()=>t.getLocaleName?t.getLocaleName()||null:l.value.find(y=>y.code===r.locale.value)?.displayName||null),i=a.ref(!1),n=a.ref(null),c=s=>{s&&(s.stopPropagation(),s.preventDefault()),i.value=!i.value},g=s=>t.customLabels[s.code]||s.displayName||s.code,m=a.computed(()=>{const s=l.value.find(y=>y.code===d.value);return s?g(s):h.value||d.value}),b=async s=>{if(i.value=!1,await a.nextTick(),t.switchLocale){t.switchLocale(s);return}if(r.locale.value=s,!o)return;const y=o.getCurrentPath(),v=t.localeRoute?(()=>{const p=t.localeRoute(y,s);return typeof p=="string"?p:p.path||"/"})():o?.resolvePath?(()=>{const p=o.resolvePath(y,s);return typeof p=="string"?p:p.path||"/"})():y;o.push({path:v})},k={position:"relative",display:"inline-block",verticalAlign:"middle"},P={padding:"4px 12px",fontSize:"16px",cursor:"pointer",backgroundColor:"#fff",border:"1px solid #333",transition:"background-color 0.3s ease",display:"flex",alignItems:"center",justifyContent:"space-between"},C={position:"absolute",top:"100%",left:"0",zIndex:1e3,backgroundColor:"#fff",border:"1px solid #333",listStyle:"none",padding:"0",margin:"4px 0 0 0",minWidth:"150px",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},O={margin:"0",padding:"0"},$={display:"block",padding:"8px 12px",color:"#333",textDecoration:"none",transition:"background-color 0.3s ease",cursor:"pointer"},R={fontWeight:"bold",color:"#007bff"},q={marginLeft:"8px",display:"inline-block",transition:"transform 0.3s ease"},H={transform:"rotate(180deg)"},L=s=>s?Array.isArray(s)?s:[s]:[],I=s=>{if(!i.value)return;const y=s.target;if(!y||!n.value)return;const v=n.value.contains(y),p=y.closest(".i18n-switcher-button")!==null;!v&&!p&&(i.value=!1)};return a.onMounted(()=>{document.addEventListener("click",I)}),a.onUnmounted(()=>{document.removeEventListener("click",I)}),()=>{const s=[];e["before-button"]&&s.push(...L(e["before-button"]()));const y=[];if(e["before-selected-locale"]&&y.push(...L(e["before-selected-locale"]())),y.push(a.h("span",m.value)),e["after-selected-locale"]&&y.push(...L(e["after-selected-locale"]())),y.push(a.h("span",{style:{...q,...i.value?H:{},...t.customIconStyle}},"▼")),s.push(a.h("button",{class:"i18n-switcher-button",style:{...P,...t.customButtonStyle},onClick:v=>{v.preventDefault(),v.stopPropagation(),c(v)},type:"button",ariaHaspopup:!0,ariaExpanded:i.value},y)),e["before-dropdown"]&&s.push(...L(e["before-dropdown"]())),i.value){const v=[];e["before-dropdown-items"]&&v.push(...L(e["before-dropdown-items"]())),l.value.forEach(p=>{const D=[];e["before-item"]&&D.push(...L(e["before-item"]({locale:p})));const M=[];e["before-link-content"]&&M.push(...L(e["before-link-content"]({locale:p}))),M.push(g(p)),e["after-link-content"]&&M.push(...L(e["after-link-content"]({locale:p})));const _=typeof window<"u"?window.location.pathname:"/",E=t.localeRoute?t.localeRoute(_,p.code):o?.resolvePath?o.resolvePath(_,p.code):_,x=typeof E=="string"?E:E.path||"#",N=p.code===d.value;D.push(a.h("a",{class:`switcher-locale-${p.code}`,href:typeof x=="string"?x:"#",style:{...$,...N?R:{},...t.customLinkStyle},onClick:K=>{K.preventDefault(),K.stopPropagation(),b(p.code)}},M)),e["after-item"]&&D.push(...L(e["after-item"]({locale:p}))),v.push(a.h("li",{key:p.code,style:{...O,...t.customItemStyle}},D))}),e["after-dropdown-items"]&&v.push(...L(e["after-dropdown-items"]())),s.push(a.h("ul",{class:"i18n-switcher-dropdown",style:{...C,...t.customDropdownStyle}},v))}return e["after-dropdown"]&&s.push(...L(e["after-dropdown"]())),a.h("div",{ref:n,class:"i18n-switcher-wrapper",style:{...k,...t.customWrapperStyle}},s)}}}),J=a.defineComponent({name:"I18nT",props:{keypath:{type:String,required:!0},plural:{type:[Number,String]},tag:{type:String,default:"span"},params:{type:Object,default:()=>({})},defaultValue:{type:String,default:""},html:{type:Boolean,default:!1},hideIfEmpty:{type:Boolean,default:!1},customPluralRule:{type:Function,default:null},number:{type:[Number,String]},date:{type:[Date,String,Number]},relativeDate:{type:[Date,String,Number]}},setup(t,{slots:e,attrs:r}){const o=a.inject(T);if(!o)throw new Error("[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.");return()=>{const u={},l=o.getRoute();if(t.number!==void 0){const n=Number(t.number),c=o.tn(n),g=o.t(t.keypath,{number:c,...t.params},void 0,l);return a.h(t.tag,{...r,innerHTML:g})}if(t.date!==void 0){const n=o.td(t.date),c=o.t(t.keypath,{date:n,...t.params},void 0,l);return a.h(t.tag,{...r,innerHTML:c})}if(t.relativeDate!==void 0){const n=o.tdr(t.relativeDate),c=o.t(t.keypath,{relativeDate:n,...t.params},void 0,l);return a.h(t.tag,{...r,innerHTML:c})}if(t.plural!==void 0){const n=Number.parseInt(t.plural.toString(),10);if(t.customPluralRule){const c=t.customPluralRule(t.keypath,n,t.params,o.locale.value,(g,m,b)=>o.t(g,m,b,l));return a.h(t.tag,{...r,innerHTML:c||""})}else{const c=o.tc(t.keypath,{count:n,...t.params});return a.h(t.tag,{...r,innerHTML:c})}}const d=(o.t(t.keypath,{...t.params,...u},void 0,l)??"").toString();if(t.hideIfEmpty&&!d.trim())return t.defaultValue??null;if(t.html)return a.h(t.tag,{...r,innerHTML:d});if(e.default)return a.h(t.tag,r,e.default({translation:d}));const h=[];let i=0;for(const[n,c]of Object.entries(e)){if(n==="default")continue;const g=`{${n}}`,m=d.indexOf(g,i);m!==-1&&(m>i&&h.push(d.slice(i,m)),c&&h.push(a.h(c)),i=m+g.length)}return i<d.length&&h.push(d.slice(i)),e.default?a.h(t.tag,r,e.default({children:h})):h.length>0?a.h(t.tag,r,h):a.h(t.tag,r,d)}}});function Q(t){const e=a.inject(T),r=a.inject(A,void 0),o=a.inject(V,void 0),u=a.inject(F,void 0);if(!e)throw new Error("[i18n-micro] useI18n() must be called after app.use(i18n). Make sure i18n plugin is installed.");if(!o)throw new Error("[i18n-micro] I18nLocalesKey not provided. Make sure app.provide(I18nLocalesKey, locales) is called.");if(!u)throw new Error("[i18n-micro] I18nDefaultLocaleKey not provided. Make sure app.provide(I18nDefaultLocaleKey, defaultLocale) is called.");const l=t?.locales||o,d=t?.defaultLocale||u,h=(i,n)=>r?.resolvePath?r.resolvePath(i,n||e.locale.value):i;return{instance:e,locale:a.computed({get:()=>e.locale.value,set:i=>{e.locale.value=i}}),getLocales:()=>l,defaultLocale:()=>d,getLocaleName:()=>l.find(n=>n.code===e.locale.value)?.displayName||null,localeRoute:h,localePath:(i,n)=>{const c=h(i,n);return typeof c=="string"?c:c.path||"/"},switchLocale:i=>{if(e.locale.value=i,r){const n=r.getCurrentPath(),c=h(n,i);r.push(typeof c=="string"?{path:c}:{path:c.path||"/"})}},t:e.t.bind(e),ts:e.ts.bind(e),tc:e.tc.bind(e),tn:e.tn.bind(e),td:e.td.bind(e),tdr:e.tdr.bind(e),has:e.has.bind(e),setRoute:e.setRoute.bind(e),getRoute:e.getRoute.bind(e),getLocale:()=>e.locale.value,addTranslations:e.addTranslations.bind(e),addRouteTranslations:e.addRouteTranslations.bind(e),mergeTranslations:e.mergeTranslations.bind(e),clearCache:e.clearCache.bind(e)}}function ee(t={}){const{addDirAttribute:e=!0,identifierAttribute:r="id",addSeoAttributes:o=!0,baseUrl:u="/"}=t,{getLocale:l,getLocales:d,localeRoute:h}=Q(),i=a.inject(A,void 0),n=a.ref({htmlAttrs:{},link:[],meta:[]});function c(m,b){const k=new URL(m,"http://localhost"),P=new URLSearchParams(k.search),C={};for(const $ of b)P.has($)&&(C[$]=P.get($));const O=new URLSearchParams(C);return O.toString()?`${k.pathname}?${O.toString()}`:k.pathname}function g(m=[]){if(!i){n.value={htmlAttrs:{},link:[],meta:[]};return}const b=l(),k=d(),P=k.find(f=>f.code===b);if(!P)return;const C=P.iso||b,O=P.og||C,$=P.dir||"auto";let R=i.getCurrentPath();R.startsWith("/")||(R=`/${R}`);const q=R.split("/").filter(Boolean),H=k.find(f=>q[0]===f.code);let L=R,I,s;const y=typeof u=="function"?u():u;if(H){L=R.slice(H.code.length+1)||"/",I=c(L,m);const f=`/${b}`;s=`${y}${f}${I.startsWith("/")?"":"/"}${I}`}else I=c(R,m),s=`${y}${I.startsWith("/")?"":"/"}${I}`;if(n.value={htmlAttrs:{lang:C,...e?{dir:$}:{}},link:[],meta:[]},!o)return;const v=k.filter(f=>!f.disabled&&f.seo!==!1),p={[r]:"i18n-og",property:"og:locale",content:O},D={[r]:"i18n-og-url",property:"og:url",content:s},M=v.filter(f=>f.code!==b).map(f=>{const j=f.og||f.iso||f.code;return{[r]:`i18n-og-alt-${j}`,property:"og:locale:alternate",content:j}}),_={[r]:"i18n-can",rel:"canonical",href:s},E=v.flatMap(f=>{if(!h||!i)return[];const j=i.getCurrentPath(),S=h(j,f.code),w=typeof S=="string"?S:S?.path||"/";if(!w)return[];let W;w.startsWith("http://")||w.startsWith("https://")?W=w:W=`${typeof u=="function"?u():u}${w.startsWith("/")?"":"/"}${w}`;const B=[{[r]:`i18n-alternate-${f.code}`,rel:"alternate",href:W,hreflang:f.code}];return f.iso&&f.iso!==f.code&&B.push({[r]:`i18n-alternate-${f.iso}`,rel:"alternate",href:W,hreflang:f.iso}),B}),x=a.inject(F,void 0);let N=null;const K=x?k.find(f=>f.code===x):void 0;if(h&&i&&x&&K?.seo!==!1){const f=i.getCurrentPath(),j=h(f,x),S=typeof j=="string"?j:j?.path||"/";if(S){let w;S.startsWith("http://")||S.startsWith("https://")?w=S:w=`${typeof u=="function"?u():u}${S.startsWith("/")?"":"/"}${S}`,N={[r]:"i18n-xd",rel:"alternate",href:w,hreflang:"x-default"}}}n.value.meta=[p,D,...M],n.value.link=[_,...E,...N?[N]:[]]}return{metaObject:n,updateMeta:g}}class X extends U.BaseI18n{constructor(e){const r={translations:new Map};if(super({storage:r,plural:e.plural,missingWarn:e.missingWarn,missingHandler:e.missingHandler}),this.listeners=new Set,this.storage=r,this._locale=a.shallowRef(e.locale),this._fallbackLocale=a.shallowRef(e.fallbackLocale||e.locale),this._currentRoute=a.shallowRef("index"),this._revision=a.shallowRef(0),e.messages)for(const[o,u]of Object.entries(e.messages))this.helper.loadTranslations(o,u)}get locale(){return this._locale}set locale(e){typeof e=="string"?this._locale.value=e:this._locale=e}get fallbackLocale(){return this._fallbackLocale}set fallbackLocale(e){typeof e=="string"?this._fallbackLocale.value=e:this._fallbackLocale=e}get currentRoute(){return this._currentRoute}setRoute(e){this._currentRoute.value=e}getLocale(){return this._locale.value}getFallbackLocale(){return this._fallbackLocale.value}getRoute(){return this._currentRoute.value}addTranslations(e,r,o=!0){super.loadTranslationsCore(e,r,o),this._revision.value++,this.notifyListeners()}addRouteTranslations(e,r,o,u=!0){super.loadRouteTranslationsCore(e,r,o,u),this._revision.value++,this.notifyListeners()}mergeTranslations(e,r,o){this.helper.mergeTranslation(e,r,o,!0),this._revision.value++,this.notifyListeners()}clearCache(){super.clearCache(),this._revision.value++,this.notifyListeners()}subscribeToChanges(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}getAllTranslations(){const e={};for(const[r,o]of this.storage.translations)if(!r.includes(":"))e[r]=o;else{const u=r.split(":")[0];u&&(e[u]||(e[u]={}),Object.assign(e[u],o))}return e}getStorage(){return this.storage}getRouteCache(){const e={};for(const[r,o]of this.storage.translations)e[r]=o;return e}}function te(t){const{routingStrategy:e,locales:r,defaultLocale:o,...u}=t,l=new X(u);let d=null,h=e||null;return{global:l,setRoutingStrategy:n=>{h=n,d&&d.provide(A,n)},install(n){d=n,n.provide(T,l),h&&n.provide(A,h),r&&n.provide(V,r),o&&n.provide(F,o),n.config.globalProperties.$t=(c,g,m,b)=>l.t(c,g,m,b),n.config.globalProperties.$ts=(c,g,m,b)=>l.ts(c,g,m,b),n.config.globalProperties.$tc=(c,g,m)=>l.tc(c,g,m),n.config.globalProperties.$tn=(c,g)=>l.tn(c,g),n.config.globalProperties.$td=(c,g)=>l.td(c,g),n.config.globalProperties.$tdr=(c,g)=>l.tdr(c,g),n.config.globalProperties.$has=(c,g)=>l.has(c,g),n.config.globalProperties.$i18n=l,n.component("I18nT",J),n.component("I18nLink",G),n.component("I18nGroup",z),n.component("I18nSwitcher",Z)}}}function ne(t,e,r){const o=e.map(l=>l.code),u=(l,d)=>{const i=(typeof l=="string"?l:l.path||"/").split("/").filter(Boolean),n=i[0];n!==void 0&&o.includes(n)&&i.shift();const c=`/${i.join("/")}`;return d===r?c:`/${d}${c==="/"?"":c}`};return{linkComponent:Y.RouterLink,getCurrentPath:()=>t.currentRoute.value.path,push:l=>{t.push(l.path).catch(()=>{})},replace:l=>{t.replace(l.path).catch(()=>{})},resolvePath:(l,d)=>u(l,d),getRoute:()=>({fullPath:t.currentRoute.value.fullPath,query:t.currentRoute.value.query})}}Object.defineProperty(exports,"FormatService",{enumerable:!0,get:()=>U.FormatService});Object.defineProperty(exports,"defaultPlural",{enumerable:!0,get:()=>U.defaultPlural});Object.defineProperty(exports,"interpolate",{enumerable:!0,get:()=>U.interpolate});exports.I18nDefaultLocaleKey=F;exports.I18nGroup=z;exports.I18nInjectionKey=T;exports.I18nLink=G;exports.I18nLocalesKey=V;exports.I18nSwitcher=Z;exports.I18nT=J;exports.VueI18n=X;exports.createI18n=te;exports.createVueRouterAdapter=ne;exports.useI18n=Q;exports.useLocaleHead=ee;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),K=require("@i18n-micro/core"),ne=require("vue-router"),T=Symbol("i18n"),F=Symbol("i18n-locales"),q=Symbol("i18n-default-locale"),A=Symbol("i18n-router-strategy"),J=a.defineComponent({name:"I18nGroup",props:{prefix:{type:String,required:!0},groupClass:{type:String,default:""}},setup(t,{slots:e}){const n=a.inject(T);if(!n)throw new Error("[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.");const o=(u,r)=>n.t(`${t.prefix}.${u}`,r,void 0,n.getRoute());return()=>a.h("div",{class:["i18n-group",t.groupClass]},e.default?.({prefix:t.prefix,t:o}))}}),Q=a.defineComponent({name:"I18nLink",props:{to:{type:[String,Object],required:!0},activeStyle:{type:Object,default:()=>({})},localeRoute:{type:Function,default:void 0}},setup(t,{slots:e}){const n=a.inject(T),o=a.inject(A,void 0);if(!n)throw new Error("[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.");const u=a.computed(()=>typeof t.to=="string"?/^(?:https?:\/\/|\/\/|[a-zA-Z0-9-]+\.[a-zA-Z]{2,})|tel:|mailto:/.test(t.to):!1),r=a.computed(()=>{if(u.value)return t.to;if(t.localeRoute){const l=t.localeRoute(t.to);return typeof l=="string"?l:l.path||"/"}if(!o?.resolvePath)return typeof t.to=="string"?t.to:t.to.path||"/";const c=o.resolvePath(t.to,n.locale.value);return typeof c=="string"?c:c.path||"/"}),d=a.computed(()=>{if(u.value||!o)return!1;const c=o.getCurrentPath().replace(/\/$/,""),l=r.value.replace(/\/$/,"");return c===l}),h=a.computed(()=>d.value?t.activeStyle:{});return()=>u.value?a.h("a",{href:r.value,target:"_blank",rel:"noopener noreferrer",style:h.value},e.default?.()):o?.linkComponent?a.h(o.linkComponent,{to:r.value,style:h.value},{default:e.default}):a.h("a",{href:r.value,style:h.value,onClick:c=>{c.preventDefault(),o?o.push({path:r.value}):window.location.href=r.value}},e.default?.())}}),X=a.defineComponent({name:"I18nSwitcher",props:{customLabels:{type:Object,default:()=>({})},customWrapperStyle:{type:Object,default:()=>({})},customButtonStyle:{type:Object,default:()=>({})},customDropdownStyle:{type:Object,default:()=>({})},customItemStyle:{type:Object,default:()=>({})},customLinkStyle:{type:Object,default:()=>({})},customActiveLinkStyle:{type:Object,default:()=>({})},customDisabledLinkStyle:{type:Object,default:()=>({})},customIconStyle:{type:Object,default:()=>({})},locales:{type:Array,default:void 0},currentLocale:{type:[String,Function],default:void 0},getLocaleName:{type:Function,default:void 0},switchLocale:{type:Function,default:void 0},localeRoute:{type:Function,default:void 0}},setup(t,{slots:e}){const n=a.inject(T),o=a.inject(A,void 0),u=a.inject(F,void 0);if(!n)throw new Error("[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.");if(!u&&!t.locales)throw new Error("[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.");const r=a.computed(()=>t.locales||u||[]),d=a.computed(()=>r.value.filter(s=>!s.disabled)),h=a.computed(()=>t.currentLocale!==void 0?typeof t.currentLocale=="function"?t.currentLocale():t.currentLocale:n.locale.value),c=a.computed(()=>r.value.some(s=>s.code===h.value&&s.disabled)),l=a.computed(()=>t.getLocaleName?t.getLocaleName()||null:r.value.find(p=>p.code===n.locale.value)?.displayName||null),i=a.ref(!1),m=a.ref(null),y=s=>{s&&(s.stopPropagation(),s.preventDefault()),i.value=!i.value},b=s=>t.customLabels[s.code]||s.displayName||s.code,S=a.computed(()=>{const s=r.value.find(p=>p.code===h.value);return s?b(s):l.value||h.value}),w=async s=>{if(i.value=!1,await a.nextTick(),t.switchLocale){t.switchLocale(s);return}if(n.locale.value=s,!o)return;const p=o.getCurrentPath(),L=t.localeRoute?(()=>{const g=t.localeRoute(p,s);return typeof g=="string"?g:g.path||"/"})():o?.resolvePath?(()=>{const g=o.resolvePath(p,s);return typeof g=="string"?g:g.path||"/"})():p;o.push({path:L})},D={position:"relative",display:"inline-block",verticalAlign:"middle"},I={padding:"4px 12px",fontSize:"16px",cursor:"pointer",backgroundColor:"#fff",border:"1px solid #333",transition:"background-color 0.3s ease",display:"flex",alignItems:"center",justifyContent:"space-between"},x={position:"absolute",top:"100%",left:"0",zIndex:1e3,backgroundColor:"#fff",border:"1px solid #333",listStyle:"none",padding:"0",margin:"4px 0 0 0",minWidth:"150px",boxShadow:"0 2px 8px rgba(0,0,0,0.15)"},R={margin:"0",padding:"0"},B={display:"block",padding:"8px 12px",color:"#333",textDecoration:"none",transition:"background-color 0.3s ease",cursor:"pointer"},W={fontWeight:"bold",color:"#007bff",cursor:"not-allowed"},V={marginLeft:"8px",display:"inline-block",transition:"transform 0.3s ease"},C={transform:"rotate(180deg)"},v=s=>s?Array.isArray(s)?s:[s]:[],E=s=>{if(!i.value)return;const p=s.target;if(!p||!m.value)return;const L=m.value.contains(p),g=p.closest(".i18n-switcher-button")!==null;!L&&!g&&(i.value=!1)};return a.onMounted(()=>{document.addEventListener("click",E)}),a.onUnmounted(()=>{document.removeEventListener("click",E)}),()=>{const s=[];e["before-button"]&&s.push(...v(e["before-button"]()));const p=[];if(e["before-selected-locale"]&&p.push(...v(e["before-selected-locale"]())),p.push(a.h("span",S.value)),e["after-selected-locale"]&&p.push(...v(e["after-selected-locale"]())),p.push(a.h("span",{style:{...V,...i.value?C:{},...t.customIconStyle}},"▼")),s.push(a.h("button",{class:"i18n-switcher-button",style:{...I,...t.customButtonStyle,...c.value?t.customDisabledLinkStyle:{}},onClick:L=>{L.preventDefault(),L.stopPropagation(),y(L)},type:"button",ariaHaspopup:!0,ariaExpanded:i.value},p)),e["before-dropdown"]&&s.push(...v(e["before-dropdown"]())),i.value){const L=[];e["before-dropdown-items"]&&L.push(...v(e["before-dropdown-items"]())),d.value.forEach(g=>{const O=[];e["before-item"]&&O.push(...v(e["before-item"]({locale:g})));const _=[];e["before-link-content"]&&_.push(...v(e["before-link-content"]({locale:g}))),_.push(b(g)),e["after-link-content"]&&_.push(...v(e["after-link-content"]({locale:g})));const N=typeof window<"u"?window.location.pathname:"/",j=t.localeRoute?t.localeRoute(N,g.code):o?.resolvePath?o.resolvePath(N,g.code):N,M=typeof j=="string"?j:j.path||"#",H=g.code===h.value;O.push(a.h("a",{class:`switcher-locale-${g.code}`,href:typeof M=="string"?M:"#",style:{...B,...H?W:{},...t.customLinkStyle,...H?t.customActiveLinkStyle:{}},onClick:f=>{f.preventDefault(),f.stopPropagation(),w(g.code)}},_)),e["after-item"]&&O.push(...v(e["after-item"]({locale:g}))),L.push(a.h("li",{key:g.code,style:{...R,...t.customItemStyle}},O))}),e["after-dropdown-items"]&&L.push(...v(e["after-dropdown-items"]())),s.push(a.h("ul",{class:"i18n-switcher-dropdown",style:{...x,...t.customDropdownStyle}},L))}return e["after-dropdown"]&&s.push(...v(e["after-dropdown"]())),a.h("div",{ref:m,class:"i18n-switcher-wrapper",style:{...D,...t.customWrapperStyle}},s)}}}),Y=a.defineComponent({name:"I18nT",props:{keypath:{type:String,required:!0},plural:{type:[Number,String]},tag:{type:String,default:"span"},params:{type:Object,default:()=>({})},defaultValue:{type:String,default:""},html:{type:Boolean,default:!1},hideIfEmpty:{type:Boolean,default:!1},customPluralRule:{type:Function,default:null},number:{type:[Number,String]},date:{type:[Date,String,Number]},relativeDate:{type:[Date,String,Number]}},setup(t,{slots:e,attrs:n}){const o=a.inject(T);if(!o)throw new Error("[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.");return()=>{const u={},r=o.getRoute();if(t.number!==void 0){const l=Number(t.number),i=o.tn(l),m=o.t(t.keypath,{number:i,...t.params},void 0,r);return a.h(t.tag,{...n,innerHTML:m})}if(t.date!==void 0){const l=o.td(t.date),i=o.t(t.keypath,{date:l,...t.params},void 0,r);return a.h(t.tag,{...n,innerHTML:i})}if(t.relativeDate!==void 0){const l=o.tdr(t.relativeDate),i=o.t(t.keypath,{relativeDate:l,...t.params},void 0,r);return a.h(t.tag,{...n,innerHTML:i})}if(t.plural!==void 0){const l=Number.parseInt(t.plural.toString(),10);if(t.customPluralRule){const i=t.customPluralRule(t.keypath,l,t.params,o.locale.value,(m,y,b)=>o.t(m,y,b,r));return a.h(t.tag,{...n,innerHTML:i||""})}else{const i=o.tc(t.keypath,{count:l,...t.params});return a.h(t.tag,{...n,innerHTML:i})}}const d=(o.t(t.keypath,{...t.params,...u},void 0,r)??"").toString();if(t.hideIfEmpty&&!d.trim())return t.defaultValue??null;if(t.html)return a.h(t.tag,{...n,innerHTML:d});if(e.default)return a.h(t.tag,n,e.default({translation:d}));const h=[];let c=0;for(const[l,i]of Object.entries(e)){if(l==="default")continue;const m=`{${l}}`,y=d.indexOf(m,c);y!==-1&&(y>c&&h.push(d.slice(c,y)),i&&h.push(a.h(i)),c=y+m.length)}return c<d.length&&h.push(d.slice(c)),e.default?a.h(t.tag,n,e.default({children:h})):h.length>0?a.h(t.tag,n,h):a.h(t.tag,n,d)}}});function z(t){const e=t.og?.trim();if(e)return e;const n=t.iso?.trim();if(!n)return null;const o=n.indexOf("_");if(o>0){const r=n.slice(0,o),d=n.slice(o+1);if(r.length>=2&&d.length===2)return`${r.toLowerCase()}_${d.toUpperCase()}`}const u=n.indexOf("-");if(u>0){const r=n.slice(0,u),d=n.slice(u+1);if(r.length>=2&&d.length===2&&/^[A-Za-z]{2}$/.test(d))return`${r.toLowerCase()}_${d.toUpperCase()}`}return null}function Z(t,e={}){if(z(t)!==null||e.missingWarn===!1||process.env.NODE_ENV==="production")return;const n=e.tag??"og:locale",o=String(t.code??"unknown"),u=t.iso?`, iso: '${t.iso}'`:"";console.warn(`[i18n] Cannot derive ${n} for locale '${o}'${u}. Set locale.og (e.g. 'en_US') or use iso with a 2-letter region (e.g. 'en-US').`)}function ee(t){const e=a.inject(T),n=a.inject(A,void 0),o=a.inject(F,void 0),u=a.inject(q,void 0);if(!e)throw new Error("[i18n-micro] useI18n() must be called after app.use(i18n). Make sure i18n plugin is installed.");if(!o)throw new Error("[i18n-micro] I18nLocalesKey not provided. Make sure app.provide(I18nLocalesKey, locales) is called.");if(!u)throw new Error("[i18n-micro] I18nDefaultLocaleKey not provided. Make sure app.provide(I18nDefaultLocaleKey, defaultLocale) is called.");const r=t?.locales||o,d=t?.defaultLocale||u,h=(c,l)=>n?.resolvePath?n.resolvePath(c,l||e.locale.value):c;return{instance:e,locale:a.computed({get:()=>e.locale.value,set:c=>{e.locale.value=c}}),getLocales:()=>r,defaultLocale:()=>d,getLocaleName:()=>r.find(l=>l.code===e.locale.value)?.displayName||null,localeRoute:h,localePath:(c,l)=>{const i=h(c,l);return typeof i=="string"?i:i.path||"/"},switchLocale:c=>{if(e.locale.value=c,n){const l=n.getCurrentPath(),i=h(l,c);n.push(typeof i=="string"?{path:i}:{path:i.path||"/"})}},t:e.t.bind(e),ts:e.ts.bind(e),tc:e.tc.bind(e),tn:e.tn.bind(e),td:e.td.bind(e),tdr:e.tdr.bind(e),has:e.has.bind(e),resolveTranslations:e.resolveTranslations.bind(e),setTranslation:e.setTranslation.bind(e),setRoute:e.setRoute.bind(e),getRoute:e.getRoute.bind(e),getLocale:()=>e.locale.value,addTranslations:e.addTranslations.bind(e),addRouteTranslations:e.addRouteTranslations.bind(e),mergeTranslations:e.mergeTranslations.bind(e),clearCache:e.clearCache.bind(e)}}function ae(t={}){const{addDirAttribute:e=!0,identifierAttribute:n="id",addSeoAttributes:o=!0,baseUrl:u="/"}=t,{getLocale:r,getLocales:d,localeRoute:h}=ee(),c=a.inject(A,void 0),l=a.ref({htmlAttrs:{},link:[],meta:[]});function i(y,b){const S=new URL(y,"http://localhost"),w=new URLSearchParams(S.search),D={};for(const x of b)w.has(x)&&(D[x]=w.get(x));const I=new URLSearchParams(D);return I.toString()?`${S.pathname}?${I.toString()}`:S.pathname}function m(y=[]){if(!c){l.value={htmlAttrs:{},link:[],meta:[]};return}const b=r(),S=d(),w=S.find(f=>f.code===b);if(!w)return;const D=w.iso||b,I=z(w),x=w.dir||"auto";let R=c.getCurrentPath();R.startsWith("/")||(R=`/${R}`);const B=R.split("/").filter(Boolean),W=S.find(f=>B[0]===f.code);let V=R,C,v;const E=typeof u=="function"?u():u;if(W){V=R.slice(W.code.length+1)||"/",C=i(V,y);const f=`/${b}`;v=`${E}${f}${C.startsWith("/")?"":"/"}${C}`}else C=i(R,y),v=`${E}${C.startsWith("/")?"":"/"}${C}`;const s={lang:D,...e?{dir:x}:{}};if(!o){l.value={htmlAttrs:s,link:[],meta:[]};return}const p=S.filter(f=>!f.disabled&&f.seo!==!1);I||Z(w,{tag:"og:locale"});const L=I?{[n]:"i18n-og",property:"og:locale",content:I}:null,g={[n]:"i18n-og-url",property:"og:url",content:v},O=p.filter(f=>f.code!==b).map(f=>{const $=z(f);return $?{[n]:`i18n-og-alt-${$}`,property:"og:locale:alternate",content:$}:(Z(f,{tag:"og:locale:alternate"}),null)}).filter(f=>f!==null),_={[n]:"i18n-can",rel:"canonical",href:v},N=p.flatMap(f=>{if(!h||!c)return[];const $=c.getCurrentPath(),k=h($,f.code),P=typeof k=="string"?k:k?.path||"/";if(!P)return[];let U;P.startsWith("http://")||P.startsWith("https://")?U=P:U=`${typeof u=="function"?u():u}${P.startsWith("/")?"":"/"}${P}`;const G=[{[n]:`i18n-alternate-${f.code}`,rel:"alternate",href:U,hreflang:f.code}];return f.iso&&f.iso!==f.code&&G.push({[n]:`i18n-alternate-${f.iso}`,rel:"alternate",href:U,hreflang:f.iso}),G}),j=a.inject(q,void 0);let M=null;const H=j?S.find(f=>f.code===j):void 0;if(h&&c&&j&&H?.seo!==!1){const f=c.getCurrentPath(),$=h(f,j),k=typeof $=="string"?$:$?.path||"/";if(k){let P;k.startsWith("http://")||k.startsWith("https://")?P=k:P=`${typeof u=="function"?u():u}${k.startsWith("/")?"":"/"}${k}`,M={[n]:"i18n-xd",rel:"alternate",href:P,hreflang:"x-default"}}}l.value={htmlAttrs:s,meta:[...L?[L]:[],g,...O],link:[_,...N,...M?[M]:[]]}}return{metaObject:l,updateMeta:m}}class te extends K.BaseI18n{constructor(e){const n={translations:new Map};if(super({storage:n,plural:e.plural,missingWarn:e.missingWarn,missingHandler:e.missingHandler}),this.listeners=new Set,this.storage=n,this._locale=a.shallowRef(e.locale),this._fallbackLocale=a.shallowRef(e.fallbackLocale||e.locale),this._currentRoute=a.shallowRef("index"),this._revision=a.shallowRef(0),e.messages)for(const[o,u]of Object.entries(e.messages))this.helper.loadTranslations(o,u)}get locale(){return this._locale}set locale(e){typeof e=="string"?this._locale.value=e:this._locale=e}get fallbackLocale(){return this._fallbackLocale}set fallbackLocale(e){typeof e=="string"?this._fallbackLocale.value=e:this._fallbackLocale=e}get currentRoute(){return this._currentRoute}setRoute(e){this._currentRoute.value=e}getLocale(){return this._locale.value}getFallbackLocale(){return this._fallbackLocale.value}getRoute(){return this._currentRoute.value}addTranslations(e,n,o=!0){super.loadTranslationsCore(e,n,o),this._revision.value++,this.notifyListeners()}addRouteTranslations(e,n,o,u=!0){super.loadRouteTranslationsCore(e,n,o,u),this._revision.value++,this.notifyListeners()}mergeTranslations(e,n,o){this.helper.mergeTranslation(e,n,o,!0),this._revision.value++,this.notifyListeners()}clearCache(){super.clearCache(),this._revision.value++,this.notifyListeners()}onTranslationsChanged(){this._revision.value++,this.notifyListeners()}subscribeToChanges(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notifyListeners(){this.listeners.forEach(e=>e())}getStorage(){return this.storage}getRouteCache(){const e={};for(const[n,o]of this.storage.translations)e[n]=o;return e}}function oe(t){const{routingStrategy:e,locales:n,defaultLocale:o,...u}=t,r=new te(u);let d=null,h=e||null;return{global:r,setRoutingStrategy:l=>{h=l,d&&d.provide(A,l)},install(l){d=l,l.provide(T,r),h&&l.provide(A,h),n&&l.provide(F,n),o&&l.provide(q,o),l.config.globalProperties.$t=(i,m,y,b)=>r.t(i,m,y,b),l.config.globalProperties.$ts=(i,m,y,b)=>r.ts(i,m,y,b),l.config.globalProperties.$tc=(i,m,y)=>r.tc(i,m,y),l.config.globalProperties.$tn=r.tn.bind(r),l.config.globalProperties.$td=r.td.bind(r),l.config.globalProperties.$tdr=r.tdr.bind(r),l.config.globalProperties.$has=(i,m)=>r.has(i,m),l.config.globalProperties.$i18n=r,l.component("I18nT",Y),l.component("I18nLink",Q),l.component("I18nGroup",J),l.component("I18nSwitcher",X)}}}function re(t,e,n){const o=e.map(r=>r.code),u=(r,d)=>{const c=(typeof r=="string"?r:r.path||"/").split("/").filter(Boolean),l=c[0];l!==void 0&&o.includes(l)&&c.shift();const i=`/${c.join("/")}`;return d===n?i:`/${d}${i==="/"?"":i}`};return{linkComponent:ne.RouterLink,getCurrentPath:()=>t.currentRoute.value.path,push:r=>{t.push(r.path).catch(()=>{})},replace:r=>{t.replace(r.path).catch(()=>{})},resolvePath:(r,d)=>u(r,d),getRoute:()=>({fullPath:t.currentRoute.value.fullPath,query:t.currentRoute.value.query})}}Object.defineProperty(exports,"FormatService",{enumerable:!0,get:()=>K.FormatService});Object.defineProperty(exports,"defaultPlural",{enumerable:!0,get:()=>K.defaultPlural});Object.defineProperty(exports,"interpolate",{enumerable:!0,get:()=>K.interpolate});exports.I18nDefaultLocaleKey=q;exports.I18nGroup=J;exports.I18nInjectionKey=T;exports.I18nLink=Q;exports.I18nLocalesKey=F;exports.I18nSwitcher=X;exports.I18nT=Y;exports.VueI18n=te;exports.createI18n=oe;exports.createVueRouterAdapter=re;exports.useI18n=ee;exports.useLocaleHead=ae;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/injection.ts","../src/components/i18n-group.ts","../src/components/i18n-link.ts","../src/components/i18n-switcher.ts","../src/components/i18n-t.ts","../src/use-i18n.ts","../src/composables/use-locale-head.ts","../src/composer.ts","../src/plugin.ts","../src/router/adapter.ts"],"sourcesContent":["import type { Locale } from '@i18n-micro/types'\nimport type { InjectionKey } from 'vue'\nimport type { VueI18n } from './composer'\nimport type { I18nRoutingStrategy } from './router/types'\n\nexport const I18nInjectionKey: InjectionKey<VueI18n> = Symbol('i18n')\nexport const I18nLocalesKey: InjectionKey<Locale[]> = Symbol('i18n-locales')\nexport const I18nDefaultLocaleKey: InjectionKey<string> = Symbol('i18n-default-locale')\nexport const I18nRouterKey: InjectionKey<I18nRoutingStrategy> = Symbol('i18n-router-strategy')\n","import type { TranslationKey } from '@i18n-micro/types'\nimport { defineComponent, h, inject } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey } from '../injection'\n\ninterface I18nGroupProps {\n prefix: string\n groupClass?: string\n}\n\nexport const I18nGroup = defineComponent<I18nGroupProps>({\n name: 'I18nGroup',\n props: {\n prefix: {\n type: String,\n required: true,\n },\n groupClass: {\n type: String,\n default: '',\n },\n },\n setup(props, { slots }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n const translate = (key: string, params?: Record<string, string | number | boolean>) => {\n // Use type assertion for dynamic keys with prefix\n // The developer is responsible for ensuring the key exists\n return i18n.t(`${props.prefix}.${key}` as TranslationKey, params, undefined, i18n.getRoute())\n }\n\n return () =>\n h(\n 'div',\n {\n class: ['i18n-group', props.groupClass],\n },\n slots.default?.({ prefix: props.prefix, t: translate }),\n )\n },\n})\n","import { type CSSProperties, computed, defineComponent, h, inject, type PropType } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey, I18nRouterKey } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\n\nexport const I18nLink = defineComponent({\n name: 'I18nLink',\n props: {\n to: {\n type: [String, Object] as PropType<string | { path?: string }>,\n required: true,\n },\n activeStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n localeRoute: {\n type: Function as PropType<(to: string | { path?: string }, locale?: string) => string | { path?: string }>,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n const routerStrategy = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n const isExternalLink = computed(() => {\n if (typeof props.to === 'string') {\n return /^(?:https?:\\/\\/|\\/\\/|[a-zA-Z0-9-]+\\.[a-zA-Z]{2,})|tel:|mailto:/.test(props.to)\n }\n return false\n })\n\n const targetPath = computed(() => {\n if (isExternalLink.value) {\n return props.to as string\n }\n\n if (props.localeRoute) {\n const res = props.localeRoute(props.to)\n return typeof res === 'string' ? res : res.path || '/'\n }\n\n if (!routerStrategy?.resolvePath) {\n return typeof props.to === 'string' ? props.to : props.to.path || '/'\n }\n\n const res = routerStrategy.resolvePath(props.to, i18n.locale.value)\n return typeof res === 'string' ? res : res.path || '/'\n })\n\n const isActive = computed(() => {\n if (isExternalLink.value || !routerStrategy) {\n return false\n }\n\n const currentPath = routerStrategy.getCurrentPath().replace(/\\/$/, '')\n const linkPath = targetPath.value.replace(/\\/$/, '')\n\n return currentPath === linkPath\n })\n\n const computedStyle = computed(() => (isActive.value ? props.activeStyle : {}))\n\n return () => {\n if (isExternalLink.value) {\n return h(\n 'a',\n {\n href: targetPath.value,\n target: '_blank',\n rel: 'noopener noreferrer',\n style: computedStyle.value,\n },\n slots.default?.(),\n )\n }\n\n if (routerStrategy?.linkComponent) {\n return h(\n routerStrategy.linkComponent,\n {\n to: targetPath.value,\n style: computedStyle.value,\n },\n { default: slots.default },\n )\n }\n\n return h(\n 'a',\n {\n href: targetPath.value,\n style: computedStyle.value,\n onClick: (e: MouseEvent) => {\n e.preventDefault()\n if (routerStrategy) {\n routerStrategy.push({ path: targetPath.value })\n } else {\n window.location.href = targetPath.value\n }\n },\n },\n slots.default?.(),\n )\n }\n },\n})\n","import type { Locale } from '@i18n-micro/types'\nimport { type CSSProperties, computed, defineComponent, h, inject, nextTick, onMounted, onUnmounted, type PropType, ref, type VNode } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey, I18nLocalesKey, I18nRouterKey } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\n\nexport const I18nSwitcher = defineComponent({\n name: 'I18nSwitcher',\n props: {\n customLabels: {\n type: Object as PropType<Record<string, string>>,\n default: () => ({}),\n },\n customWrapperStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customButtonStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customDropdownStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customItemStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customLinkStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customActiveLinkStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customDisabledLinkStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customIconStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n locales: {\n type: Array as PropType<Locale[]>,\n default: undefined,\n },\n currentLocale: {\n type: [String, Function] as PropType<string | (() => string)>,\n default: undefined,\n },\n getLocaleName: {\n type: Function as PropType<() => string | null>,\n default: undefined,\n },\n switchLocale: {\n type: Function as PropType<(locale: string) => void>,\n default: undefined,\n },\n localeRoute: {\n type: Function as PropType<(to: string | { path?: string }, locale?: string) => string | { path?: string }>,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n const routerStrategy = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n const injectedLocales = inject<Locale[] | undefined>(I18nLocalesKey, undefined)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n if (!injectedLocales && !props.locales) {\n throw new Error(\n '[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.',\n )\n }\n\n const locales = computed(() => props.locales || injectedLocales || [])\n const currentLocale = computed(() => {\n if (props.currentLocale !== undefined) {\n return typeof props.currentLocale === 'function' ? props.currentLocale() : props.currentLocale\n }\n return i18n.locale.value\n })\n const currentLocaleName = computed(() => {\n if (props.getLocaleName) {\n return props.getLocaleName() || null\n }\n const current = locales.value.find((l) => l.code === i18n.locale.value)\n return current?.displayName || null\n })\n\n const dropdownOpen = ref(false)\n const wrapperRef = ref<HTMLElement | null>(null)\n\n const toggleDropdown = (event?: Event) => {\n if (event) {\n event.stopPropagation()\n event.preventDefault()\n }\n dropdownOpen.value = !dropdownOpen.value\n }\n\n const localeLabel = (localeItem: Locale) => {\n const current = props.customLabels[localeItem.code] || localeItem.displayName\n return current || localeItem.code\n }\n\n const currentLocaleLabel = computed(() => {\n const current = locales.value.find((l) => l.code === currentLocale.value)\n return current ? localeLabel(current) : currentLocaleName.value || currentLocale.value\n })\n\n const handleSwitchLocale = async (code: string) => {\n dropdownOpen.value = false\n await nextTick()\n\n if (props.switchLocale) {\n props.switchLocale(code)\n return\n }\n\n i18n.locale.value = code\n\n if (!routerStrategy) {\n return\n }\n\n const currentPath = routerStrategy.getCurrentPath()\n const newPath = props.localeRoute\n ? (() => {\n const res = props.localeRoute(currentPath, code)\n return typeof res === 'string' ? res : res.path || '/'\n })()\n : routerStrategy?.resolvePath\n ? (() => {\n const res = routerStrategy.resolvePath(currentPath, code)\n return typeof res === 'string' ? res : res.path || '/'\n })()\n : currentPath\n\n routerStrategy.push({ path: newPath })\n }\n\n // Default Styles\n const wrapperStyle: CSSProperties = {\n position: 'relative',\n display: 'inline-block',\n verticalAlign: 'middle',\n }\n\n const buttonStyle: CSSProperties = {\n padding: '4px 12px',\n fontSize: '16px',\n cursor: 'pointer',\n backgroundColor: '#fff',\n border: '1px solid #333',\n transition: 'background-color 0.3s ease',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }\n\n const dropdownStyle: CSSProperties = {\n position: 'absolute',\n top: '100%',\n left: '0',\n zIndex: 1000,\n backgroundColor: '#fff',\n border: '1px solid #333',\n listStyle: 'none',\n padding: '0',\n margin: '4px 0 0 0',\n minWidth: '150px',\n boxShadow: '0 2px 8px rgba(0,0,0,0.15)',\n }\n\n const itemStyle: CSSProperties = {\n margin: '0',\n padding: '0',\n }\n\n const linkStyle: CSSProperties = {\n display: 'block',\n padding: '8px 12px',\n color: '#333',\n textDecoration: 'none',\n transition: 'background-color 0.3s ease',\n cursor: 'pointer',\n }\n\n const activeLinkStyle: CSSProperties = {\n fontWeight: 'bold',\n color: '#007bff',\n }\n\n const iconStyle: CSSProperties = {\n marginLeft: '8px',\n display: 'inline-block',\n transition: 'transform 0.3s ease',\n }\n\n const openIconStyle: CSSProperties = {\n transform: 'rotate(180deg)',\n }\n\n const normalizeSlot = (slotResult: unknown): (VNode | string)[] => {\n if (!slotResult) return []\n return Array.isArray(slotResult) ? slotResult : [slotResult as VNode]\n }\n\n // Simplified and reliable outside click logic\n const handleClickOutside = (event: MouseEvent) => {\n if (!dropdownOpen.value) return\n\n const target = event.target as HTMLElement\n if (!target || !wrapperRef.value) return\n\n // Check that the click is not inside our wrapper\n const isClickInside = wrapperRef.value.contains(target)\n\n // Also check if the target is the switcher button\n const isButtonClick = target.closest('.i18n-switcher-button') !== null\n\n if (!isClickInside && !isButtonClick) {\n dropdownOpen.value = false\n }\n }\n\n onMounted(() => {\n // Use regular bubbling, but with a slight delay to give the dropdown time to open\n document.addEventListener('click', handleClickOutside)\n })\n\n onUnmounted(() => {\n document.removeEventListener('click', handleClickOutside)\n })\n\n return () => {\n const children: (VNode | string)[] = []\n\n // 1. Button rendering\n if (slots['before-button']) {\n children.push(...normalizeSlot(slots['before-button']()))\n }\n\n const buttonContent: (VNode | string)[] = []\n if (slots['before-selected-locale']) {\n buttonContent.push(...normalizeSlot(slots['before-selected-locale']()))\n }\n\n buttonContent.push(h('span', currentLocaleLabel.value))\n\n if (slots['after-selected-locale']) {\n buttonContent.push(...normalizeSlot(slots['after-selected-locale']()))\n }\n\n buttonContent.push(\n h(\n 'span',\n {\n style: {\n ...iconStyle,\n ...(dropdownOpen.value ? openIconStyle : {}),\n ...props.customIconStyle,\n },\n },\n '▼',\n ),\n )\n\n children.push(\n h(\n 'button',\n {\n class: 'i18n-switcher-button',\n style: { ...buttonStyle, ...props.customButtonStyle },\n onClick: (e: MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDropdown(e)\n },\n type: 'button',\n ariaHaspopup: true,\n ariaExpanded: dropdownOpen.value,\n },\n buttonContent,\n ),\n )\n\n // 2. Dropdown rendering\n if (slots['before-dropdown']) {\n children.push(...normalizeSlot(slots['before-dropdown']()))\n }\n\n if (dropdownOpen.value) {\n const dropdownItems: VNode[] = []\n\n if (slots['before-dropdown-items']) {\n dropdownItems.push(...(normalizeSlot(slots['before-dropdown-items']()) as VNode[]))\n }\n\n locales.value.forEach((localeItem) => {\n const itemChildren: (VNode | string)[] = []\n\n if (slots['before-item']) {\n itemChildren.push(...normalizeSlot(slots['before-item']({ locale: localeItem })))\n }\n\n const linkContent: (VNode | string)[] = []\n if (slots['before-link-content']) {\n linkContent.push(...normalizeSlot(slots['before-link-content']({ locale: localeItem })))\n }\n linkContent.push(localeLabel(localeItem))\n if (slots['after-link-content']) {\n linkContent.push(...normalizeSlot(slots['after-link-content']({ locale: localeItem })))\n }\n\n const currentPath = typeof window !== 'undefined' ? window.location.pathname : '/'\n const result = props.localeRoute\n ? props.localeRoute(currentPath, localeItem.code)\n : routerStrategy?.resolvePath\n ? routerStrategy.resolvePath(currentPath, localeItem.code)\n : currentPath\n const routeTo = typeof result === 'string' ? result : result.path || '#'\n const isActive = localeItem.code === currentLocale.value\n\n itemChildren.push(\n h(\n 'a',\n {\n class: `switcher-locale-${localeItem.code}`,\n href: typeof routeTo === 'string' ? routeTo : '#',\n style: {\n ...linkStyle,\n ...(isActive ? activeLinkStyle : {}),\n ...props.customLinkStyle,\n },\n // Prevent default navigation, use only handleSwitchLocale\n onClick: (e: MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n handleSwitchLocale(localeItem.code)\n },\n },\n linkContent,\n ),\n )\n\n if (slots['after-item']) {\n itemChildren.push(...normalizeSlot(slots['after-item']({ locale: localeItem })))\n }\n\n dropdownItems.push(\n h(\n 'li',\n {\n key: localeItem.code,\n style: { ...itemStyle, ...props.customItemStyle },\n },\n itemChildren,\n ),\n )\n })\n\n if (slots['after-dropdown-items']) {\n dropdownItems.push(...(normalizeSlot(slots['after-dropdown-items']()) as VNode[]))\n }\n\n // Render UL right here, WITHOUT Teleport\n children.push(\n h(\n 'ul',\n {\n class: 'i18n-switcher-dropdown',\n style: { ...dropdownStyle, ...props.customDropdownStyle },\n },\n dropdownItems,\n ),\n )\n }\n\n if (slots['after-dropdown']) {\n children.push(...normalizeSlot(slots['after-dropdown']()))\n }\n\n // Return wrapper with ref\n return h(\n 'div',\n {\n ref: wrapperRef,\n class: 'i18n-switcher-wrapper',\n style: { ...wrapperStyle, ...props.customWrapperStyle },\n },\n children,\n )\n }\n },\n})\n","import type { PluralFunc, TranslationKey } from '@i18n-micro/types'\nimport { defineComponent, h, inject, type PropType, type VNode } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey } from '../injection'\n\nexport const I18nT = defineComponent({\n name: 'I18nT',\n props: {\n keypath: {\n type: String as PropType<TranslationKey>,\n required: true,\n },\n plural: {\n type: [Number, String] as PropType<number | string>,\n },\n tag: {\n type: String as PropType<string>,\n default: 'span',\n },\n params: {\n type: Object as PropType<Record<string, string | number | boolean>>,\n default: () => ({}),\n },\n defaultValue: {\n type: String as PropType<string>,\n default: '',\n },\n html: {\n type: Boolean as PropType<boolean>,\n default: false,\n },\n hideIfEmpty: {\n type: Boolean as PropType<boolean>,\n default: false,\n },\n customPluralRule: {\n type: Function as PropType<PluralFunc>,\n default: null,\n },\n number: {\n type: [Number, String] as PropType<number | string>,\n },\n date: {\n type: [Date, String, Number] as PropType<Date | string | number>,\n },\n relativeDate: {\n type: [Date, String, Number] as PropType<Date | string | number>,\n },\n },\n setup(props, { slots, attrs }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n return () => {\n const options: Record<string, string | number | boolean> = {}\n const route = i18n.getRoute()\n\n // Handle number formatting\n if (props.number !== undefined) {\n const numberValue = Number(props.number)\n const formattedNumber = i18n.tn(numberValue)\n const translation = i18n.t(props.keypath, { number: formattedNumber, ...props.params }, undefined, route)\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle date formatting\n if (props.date !== undefined) {\n const formattedDate = i18n.td(props.date)\n const translation = i18n.t(props.keypath, { date: formattedDate, ...props.params }, undefined, route)\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle relative date formatting\n if (props.relativeDate !== undefined) {\n const formattedRelativeDate = i18n.tdr(props.relativeDate)\n const translation = i18n.t(props.keypath, { relativeDate: formattedRelativeDate, ...props.params }, undefined, route)\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle pluralization\n if (props.plural !== undefined) {\n const count = Number.parseInt(props.plural.toString(), 10)\n if (props.customPluralRule) {\n const translation = props.customPluralRule(\n props.keypath,\n count,\n props.params,\n i18n.locale.value,\n (k: TranslationKey, p?: Record<string, string | number | boolean>, dv?: string) => i18n.t(k, p, dv, route),\n )\n return h(props.tag, { ...attrs, innerHTML: translation || '' })\n } else {\n const translation = i18n.tc(props.keypath, { count, ...props.params })\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n }\n\n // Regular translation\n const translation = (i18n.t(props.keypath, { ...props.params, ...options }, undefined, route) ?? '').toString()\n\n if (props.hideIfEmpty && !translation.trim()) {\n return props.defaultValue ?? null\n }\n\n if (props.html) {\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle slots\n if (slots.default) {\n return h(props.tag, attrs, slots.default({ translation }))\n }\n\n // Handle named slots for interpolation\n const children: (string | VNode)[] = []\n let lastIndex = 0\n\n for (const [slotName, slotFn] of Object.entries(slots)) {\n if (slotName === 'default') continue\n\n const placeholder = `{${slotName}}`\n const index = translation.indexOf(placeholder, lastIndex)\n\n if (index !== -1) {\n if (index > lastIndex) {\n children.push(translation.slice(lastIndex, index))\n }\n\n if (slotFn) {\n children.push(h(slotFn))\n }\n\n lastIndex = index + placeholder.length\n }\n }\n\n if (lastIndex < translation.length) {\n children.push(translation.slice(lastIndex))\n }\n\n if (slots.default) {\n return h(props.tag, attrs, slots.default({ children }))\n }\n\n if (children.length > 0) {\n return h(props.tag, attrs, children)\n }\n\n return h(props.tag, attrs, translation)\n }\n },\n})\n","import type { Locale } from '@i18n-micro/types'\nimport { computed, inject } from 'vue'\nimport type { VueI18n } from './composer'\nimport { I18nDefaultLocaleKey, I18nInjectionKey, I18nLocalesKey, I18nRouterKey } from './injection'\nimport type { I18nRoutingStrategy } from './router/types'\n\nexport interface UseI18nOptions {\n locales?: Locale[]\n defaultLocale?: string\n}\n\n/**\n * Get the i18n instance from the Vue app context\n * Returns the same instance that was created with createI18n()\n */\nexport function useI18n(options?: UseI18nOptions) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n const router = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n const injectedLocales = inject<Locale[] | undefined>(I18nLocalesKey, undefined)\n const injectedDefaultLocale = inject<string | undefined>(I18nDefaultLocaleKey, undefined)\n\n if (!i18n) {\n throw new Error('[i18n-micro] useI18n() must be called after app.use(i18n). Make sure i18n plugin is installed.')\n }\n\n if (!injectedLocales) {\n throw new Error('[i18n-micro] I18nLocalesKey not provided. Make sure app.provide(I18nLocalesKey, locales) is called.')\n }\n\n if (!injectedDefaultLocale) {\n throw new Error('[i18n-micro] I18nDefaultLocaleKey not provided. Make sure app.provide(I18nDefaultLocaleKey, defaultLocale) is called.')\n }\n\n const locales = options?.locales || injectedLocales\n const defaultLocale = options?.defaultLocale || injectedDefaultLocale\n\n const resolveLocalePath = (to: string | { path?: string }, localeCode?: string): string | { path?: string } => {\n if (!router?.resolvePath) {\n return to\n }\n return router.resolvePath(to, localeCode || i18n.locale.value)\n }\n\n return {\n // Direct access to instance\n instance: i18n,\n\n // Locale (reactive)\n locale: computed({\n get: () => i18n.locale.value,\n set: (val: string) => {\n i18n.locale.value = val\n },\n }),\n\n // Locale helpers\n getLocales: () => locales,\n defaultLocale: () => defaultLocale,\n getLocaleName: () => {\n const current = locales.find((l) => l.code === i18n.locale.value)\n return current?.displayName || null\n },\n\n // Routing helpers\n localeRoute: resolveLocalePath,\n localePath: (to: string | { path?: string }, locale?: string): string => {\n const res = resolveLocalePath(to, locale)\n return typeof res === 'string' ? res : res.path || '/'\n },\n switchLocale: (newLocale: string) => {\n i18n.locale.value = newLocale\n if (router) {\n const currentPath = router.getCurrentPath()\n const newPath = resolveLocalePath(currentPath, newLocale)\n router.push(typeof newPath === 'string' ? { path: newPath } : { path: newPath.path || '/' })\n }\n },\n\n // Translation methods (delegate to instance)\n t: i18n.t.bind(i18n),\n ts: i18n.ts.bind(i18n),\n tc: i18n.tc.bind(i18n),\n tn: i18n.tn.bind(i18n),\n td: i18n.td.bind(i18n),\n tdr: i18n.tdr.bind(i18n),\n has: i18n.has.bind(i18n),\n\n // Route management\n setRoute: i18n.setRoute.bind(i18n),\n getRoute: i18n.getRoute.bind(i18n),\n getLocale: () => i18n.locale.value,\n\n // Translation management\n addTranslations: i18n.addTranslations.bind(i18n),\n addRouteTranslations: i18n.addRouteTranslations.bind(i18n),\n mergeTranslations: i18n.mergeTranslations.bind(i18n),\n clearCache: i18n.clearCache.bind(i18n),\n }\n}\n","import type { Locale } from '@i18n-micro/types'\nimport { inject, ref } from 'vue'\nimport { I18nDefaultLocaleKey, I18nRouterKey } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\nimport { useI18n } from '../use-i18n'\n\ninterface MetaLink {\n [key: string]: string | undefined\n rel: string\n href: string\n hreflang?: string\n}\n\ninterface MetaTag {\n [key: string]: string\n property: string\n content: string\n}\n\ninterface MetaObject {\n htmlAttrs: {\n lang?: string\n dir?: 'ltr' | 'rtl' | 'auto'\n }\n link: MetaLink[]\n meta: MetaTag[]\n}\n\nexport interface UseLocaleHeadOptions {\n addDirAttribute?: boolean\n identifierAttribute?: string\n addSeoAttributes?: boolean\n baseUrl?: string | (() => string)\n}\n\nexport function useLocaleHead(options: UseLocaleHeadOptions = {}) {\n const { addDirAttribute = true, identifierAttribute = 'id', addSeoAttributes = true, baseUrl = '/' } = options\n\n const { getLocale, getLocales, localeRoute: i18nLocaleRoute } = useI18n()\n const routerStrategy = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n\n const metaObject = ref<MetaObject>({\n htmlAttrs: {},\n link: [],\n meta: [],\n })\n\n function filterQuery(fullPath: string, whitelist: string[]): string {\n const url = new URL(fullPath, 'http://localhost')\n const params = new URLSearchParams(url.search)\n const filtered: Record<string, string> = {}\n for (const key of whitelist) {\n if (params.has(key)) {\n filtered[key] = params.get(key) as string\n }\n }\n const filteredParams = new URLSearchParams(filtered)\n return filteredParams.toString() ? `${url.pathname}?${filteredParams.toString()}` : url.pathname\n }\n\n function updateMeta(canonicalQueryWhitelist: string[] = []) {\n if (!routerStrategy) {\n metaObject.value = { htmlAttrs: {}, link: [], meta: [] }\n return\n }\n\n const locale = getLocale()\n const allLocales = getLocales()\n const currentLocaleObj = allLocales.find((loc: Locale) => loc.code === locale)\n\n if (!currentLocaleObj) {\n return\n }\n\n const currentIso = currentLocaleObj.iso || locale\n const currentOg = currentLocaleObj.og || currentIso\n const currentDir = currentLocaleObj.dir || 'auto'\n\n let fullPath = routerStrategy.getCurrentPath()\n if (!fullPath.startsWith('/')) {\n fullPath = `/${fullPath}`\n }\n\n const pathSegments = fullPath.split('/').filter(Boolean)\n const matchedLocale = allLocales.find((localeItem: Locale) => pathSegments[0] === localeItem.code)\n\n let localizedPath = fullPath\n let canonicalPath: string\n\n let ogUrl: string\n const baseUrlValue = typeof baseUrl === 'function' ? baseUrl() : baseUrl\n\n if (matchedLocale) {\n localizedPath = fullPath.slice(matchedLocale.code.length + 1) || '/'\n canonicalPath = filterQuery(localizedPath, canonicalQueryWhitelist)\n const localePrefix = `/${locale}`\n ogUrl = `${baseUrlValue}${localePrefix}${canonicalPath.startsWith('/') ? '' : '/'}${canonicalPath}`\n } else {\n canonicalPath = filterQuery(fullPath, canonicalQueryWhitelist)\n ogUrl = `${baseUrlValue}${canonicalPath.startsWith('/') ? '' : '/'}${canonicalPath}`\n }\n\n metaObject.value = {\n htmlAttrs: {\n lang: currentIso,\n ...(addDirAttribute ? { dir: currentDir } : {}),\n },\n link: [],\n meta: [],\n }\n\n if (!addSeoAttributes) {\n return\n }\n\n const alternateLocales = allLocales.filter((loc: Locale) => !loc.disabled && loc.seo !== false)\n\n const ogLocaleMeta: MetaTag = {\n [identifierAttribute]: 'i18n-og',\n property: 'og:locale',\n content: currentOg,\n }\n\n const ogUrlMeta: MetaTag = {\n [identifierAttribute]: 'i18n-og-url',\n property: 'og:url',\n content: ogUrl,\n }\n\n const alternateOgLocalesMeta = alternateLocales\n .filter((loc: Locale) => loc.code !== locale)\n .map((loc: Locale) => {\n const ogAlt = loc.og || loc.iso || loc.code\n return {\n [identifierAttribute]: `i18n-og-alt-${ogAlt}`,\n property: 'og:locale:alternate',\n content: ogAlt,\n }\n })\n\n const canonicalLink: MetaLink = {\n [identifierAttribute]: 'i18n-can',\n rel: 'canonical',\n href: ogUrl,\n }\n\n const alternateLinks: MetaLink[] = alternateLocales.flatMap((loc: Locale) => {\n if (!i18nLocaleRoute || !routerStrategy) {\n return []\n }\n\n const currentPath = routerStrategy.getCurrentPath()\n // Use i18n's localeRoute which delegates to router strategy\n const switchedPathResult = i18nLocaleRoute(currentPath, loc.code)\n const switchedPath = typeof switchedPathResult === 'string' ? switchedPathResult : switchedPathResult?.path || '/'\n if (!switchedPath) {\n return []\n }\n\n let href: string\n if (switchedPath.startsWith('http://') || switchedPath.startsWith('https://')) {\n href = switchedPath\n } else {\n const baseUrlValue = typeof baseUrl === 'function' ? baseUrl() : baseUrl\n href = `${baseUrlValue}${switchedPath.startsWith('/') ? '' : '/'}${switchedPath}`\n }\n\n const links: MetaLink[] = [\n {\n [identifierAttribute]: `i18n-alternate-${loc.code}`,\n rel: 'alternate',\n href,\n hreflang: loc.code,\n },\n ]\n\n if (loc.iso && loc.iso !== loc.code) {\n links.push({\n [identifierAttribute]: `i18n-alternate-${loc.iso}`,\n rel: 'alternate',\n href,\n hreflang: loc.iso,\n })\n }\n\n return links\n })\n\n // Generate x-default hreflang link pointing to the default locale's URL.\n // x-default tells search engines which URL to show when none of the\n // specified languages match the user's browser settings.\n const injectedDefaultLocale = inject<string | undefined>(I18nDefaultLocaleKey, undefined)\n let xDefaultLink: MetaLink | null = null\n const defaultLocObj = injectedDefaultLocale ? allLocales.find((l: Locale) => l.code === injectedDefaultLocale) : undefined\n if (i18nLocaleRoute && routerStrategy && injectedDefaultLocale && defaultLocObj?.seo !== false) {\n const currentPath = routerStrategy.getCurrentPath()\n const defaultPathResult = i18nLocaleRoute(currentPath, injectedDefaultLocale)\n const defaultPath = typeof defaultPathResult === 'string' ? defaultPathResult : defaultPathResult?.path || '/'\n if (defaultPath) {\n let xDefaultHref: string\n if (defaultPath.startsWith('http://') || defaultPath.startsWith('https://')) {\n xDefaultHref = defaultPath\n } else {\n const baseUrlValue = typeof baseUrl === 'function' ? baseUrl() : baseUrl\n xDefaultHref = `${baseUrlValue}${defaultPath.startsWith('/') ? '' : '/'}${defaultPath}`\n }\n xDefaultLink = {\n [identifierAttribute]: 'i18n-xd',\n rel: 'alternate',\n href: xDefaultHref,\n hreflang: 'x-default',\n }\n }\n }\n\n metaObject.value.meta = [ogLocaleMeta, ogUrlMeta, ...alternateOgLocalesMeta]\n metaObject.value.link = [canonicalLink, ...alternateLinks, ...(xDefaultLink ? [xDefaultLink] : [])]\n }\n\n return {\n metaObject,\n updateMeta,\n }\n}\n","import { BaseI18n, type TranslationStorage } from '@i18n-micro/core'\nimport type { PluralFunc, Translations } from '@i18n-micro/types'\nimport { type Ref, shallowRef } from 'vue'\n\nexport interface VueI18nOptions {\n locale: string\n fallbackLocale?: string\n messages?: Record<string, Translations>\n plural?: PluralFunc\n missingWarn?: boolean\n missingHandler?: (locale: string, key: string, routeName: string) => void\n}\n\nexport class VueI18n extends BaseI18n {\n private _locale: Ref<string>\n private _fallbackLocale: Ref<string>\n private _currentRoute: Ref<string>\n private _revision: Ref<number>\n\n public readonly storage: TranslationStorage\n\n private listeners: Set<() => void> = new Set()\n\n constructor(options: VueI18nOptions) {\n const storage: TranslationStorage = {\n translations: new Map<string, Translations>(),\n }\n\n super({\n storage,\n plural: options.plural,\n missingWarn: options.missingWarn,\n missingHandler: options.missingHandler,\n })\n\n this.storage = storage\n this._locale = shallowRef(options.locale)\n this._fallbackLocale = shallowRef(options.fallbackLocale || options.locale)\n this._currentRoute = shallowRef('index')\n this._revision = shallowRef(0)\n\n if (options.messages) {\n for (const [lang, msgs] of Object.entries(options.messages)) {\n this.helper.loadTranslations(lang, msgs)\n }\n }\n }\n\n get locale(): Ref<string> {\n return this._locale\n }\n\n set locale(val: Ref<string> | string) {\n if (typeof val === 'string') {\n this._locale.value = val\n } else {\n this._locale = val\n }\n }\n\n get fallbackLocale(): Ref<string> {\n return this._fallbackLocale\n }\n\n set fallbackLocale(val: Ref<string> | string) {\n if (typeof val === 'string') {\n this._fallbackLocale.value = val\n } else {\n this._fallbackLocale = val\n }\n }\n\n get currentRoute(): Ref<string> {\n return this._currentRoute\n }\n\n setRoute(routeName: string): void {\n this._currentRoute.value = routeName\n }\n\n public getLocale(): string {\n return this._locale.value\n }\n\n public getFallbackLocale(): string {\n return this._fallbackLocale.value\n }\n\n public getRoute(): string {\n return this._currentRoute.value\n }\n\n public addTranslations(locale: string, translations: Translations, merge = true): void {\n super.loadTranslationsCore(locale, translations, merge)\n this._revision.value++\n this.notifyListeners()\n }\n\n public addRouteTranslations(locale: string, routeName: string, translations: Translations, merge = true): void {\n super.loadRouteTranslationsCore(locale, routeName, translations, merge)\n this._revision.value++\n this.notifyListeners()\n }\n\n public mergeTranslations(locale: string, routeName: string, translations: Translations): void {\n this.helper.mergeTranslation(locale, routeName, translations, true)\n this._revision.value++\n this.notifyListeners()\n }\n\n public override clearCache(): void {\n super.clearCache()\n this._revision.value++\n this.notifyListeners()\n }\n\n public subscribeToChanges(cb: () => void): () => void {\n this.listeners.add(cb)\n return () => this.listeners.delete(cb)\n }\n\n private notifyListeners(): void {\n this.listeners.forEach((cb) => cb())\n }\n\n public getAllTranslations(): Record<string, Translations> {\n const result: Record<string, Translations> = {}\n for (const [key, translations] of this.storage.translations) {\n if (!key.includes(':')) {\n result[key] = translations\n } else {\n const locale = key.split(':')[0]\n if (locale) {\n if (!result[locale]) result[locale] = {}\n Object.assign(result[locale], translations)\n }\n }\n }\n return result\n }\n\n public getStorage(): TranslationStorage {\n return this.storage\n }\n\n public getRouteCache(): Record<string, Translations> {\n const result: Record<string, Translations> = {}\n for (const [key, value] of this.storage.translations) {\n result[key] = value\n }\n return result\n }\n}\n","import type { Locale, TranslationKey } from '@i18n-micro/types'\nimport type { App, Plugin } from 'vue'\nimport { I18nGroup } from './components/i18n-group'\nimport { I18nLink } from './components/i18n-link'\nimport { I18nSwitcher } from './components/i18n-switcher'\nimport { I18nT } from './components/i18n-t'\nimport { VueI18n, type VueI18nOptions } from './composer'\nimport { I18nDefaultLocaleKey, I18nInjectionKey, I18nLocalesKey, I18nRouterKey } from './injection'\nimport type { I18nRoutingStrategy } from './router/types'\n\nexport interface CreateI18nOptions extends VueI18nOptions {\n routingStrategy?: I18nRoutingStrategy\n /**\n * Array of locale configurations\n * If provided, will be automatically provided to the app via I18nLocalesKey\n */\n locales?: Locale[]\n /**\n * Default locale code\n * If provided, will be automatically provided to the app via I18nDefaultLocaleKey\n */\n defaultLocale?: string\n}\n\nexport type I18nPlugin = Plugin & {\n global: VueI18n\n setRoutingStrategy: (strategy: I18nRoutingStrategy) => void\n}\n\nexport function createI18n(options: CreateI18nOptions): I18nPlugin {\n const { routingStrategy, locales, defaultLocale, ...i18nOptions } = options\n const i18n = new VueI18n(i18nOptions)\n\n let currentApp: App | null = null\n let currentStrategy: I18nRoutingStrategy | null = routingStrategy || null\n\n const setRoutingStrategy = (strategy: I18nRoutingStrategy) => {\n currentStrategy = strategy\n if (currentApp) {\n currentApp.provide(I18nRouterKey, strategy)\n }\n }\n\n return {\n global: i18n, // Access to instance outside components\n setRoutingStrategy, // Method for setting adapter after creation\n install(app: App) {\n currentApp = app\n // 1. Provide for useI18n\n app.provide(I18nInjectionKey, i18n)\n\n // 2. Provide routing strategy if provided\n if (currentStrategy) {\n app.provide(I18nRouterKey, currentStrategy)\n }\n\n // 3. Automatically provide locales and defaultLocale if provided in options\n // This improves DX by eliminating the need for manual provide calls\n if (locales) {\n app.provide(I18nLocalesKey, locales)\n }\n if (defaultLocale) {\n app.provide(I18nDefaultLocaleKey, defaultLocale)\n }\n\n // 4. Global properties ($t, $tc, etc.)\n // Note: In templates, these may be called with string literals, so we use TranslationKey type\n app.config.globalProperties.$t = (\n key: TranslationKey,\n params?: Record<string, string | number | boolean>,\n defaultValue?: string | null,\n routeName?: string,\n ) => {\n return i18n.t(key, params, defaultValue, routeName)\n }\n app.config.globalProperties.$ts = (\n key: TranslationKey,\n params?: Record<string, string | number | boolean>,\n defaultValue?: string,\n routeName?: string,\n ) => {\n return i18n.ts(key, params, defaultValue, routeName)\n }\n app.config.globalProperties.$tc = (key: TranslationKey, count: number | Record<string, string | number | boolean>, defaultValue?: string) => {\n return i18n.tc(key, count, defaultValue)\n }\n app.config.globalProperties.$tn = (value: number, options?: Intl.NumberFormatOptions) => {\n return i18n.tn(value, options)\n }\n app.config.globalProperties.$td = (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => {\n return i18n.td(value, options)\n }\n app.config.globalProperties.$tdr = (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => {\n return i18n.tdr(value, options)\n }\n app.config.globalProperties.$has = (key: TranslationKey, routeName?: string) => {\n return i18n.has(key, routeName)\n }\n // Provide access to i18n instance via $i18n\n // Using unknown and then casting to avoid any, but Vue's globalProperties requires flexibility\n app.config.globalProperties.$i18n = i18n as any\n\n // 5. Register components\n app.component('I18nT', I18nT)\n app.component('I18nLink', I18nLink)\n app.component('I18nGroup', I18nGroup)\n app.component('I18nSwitcher', I18nSwitcher)\n },\n }\n}\n","import type { Locale } from '@i18n-micro/types'\nimport type { Router } from 'vue-router'\nimport { RouterLink } from 'vue-router'\nimport type { I18nRoutingStrategy } from './types'\n\n/**\n * Factory for Vue Router adapter\n * Implements routing utilities for Vue Router\n * Uses vue-router APIs for navigation and path resolution\n */\nexport function createVueRouterAdapter(router: Router, locales: Locale[], defaultLocale: string): I18nRoutingStrategy {\n const localeCodes = locales.map((loc) => loc.code)\n\n /**\n * Path resolution logic (add prefix or not)\n */\n const resolvePath = (to: string | { path?: string }, locale: string): string => {\n const path = typeof to === 'string' ? to : to.path || '/'\n const pathSegments = path.split('/').filter(Boolean)\n\n // If path already starts with a locale, remove it\n const first = pathSegments[0]\n if (first !== undefined && localeCodes.includes(first)) {\n pathSegments.shift()\n }\n\n const cleanPath = `/${pathSegments.join('/')}`\n\n // If default locale - return clean path\n if (locale === defaultLocale) {\n return cleanPath\n }\n\n // Otherwise add prefix\n return `/${locale}${cleanPath === '/' ? '' : cleanPath}`\n }\n\n return {\n linkComponent: RouterLink,\n\n getCurrentPath: () => {\n // currentRoute in Vue Router is reactive\n return router.currentRoute.value.path\n },\n\n push: (target: { path: string }) => {\n router.push(target.path).catch(() => {})\n },\n\n replace: (target: { path: string }) => {\n router.replace(target.path).catch(() => {})\n },\n\n resolvePath: (to: string | { path?: string }, locale: string) => resolvePath(to, locale),\n\n getRoute: () => ({\n fullPath: router.currentRoute.value.fullPath,\n query: router.currentRoute.value.query,\n }),\n }\n}\n"],"names":["I18nInjectionKey","I18nLocalesKey","I18nDefaultLocaleKey","I18nRouterKey","I18nGroup","defineComponent","props","slots","i18n","inject","translate","key","params","h","I18nLink","routerStrategy","isExternalLink","computed","targetPath","res","isActive","currentPath","linkPath","computedStyle","e","I18nSwitcher","injectedLocales","locales","currentLocale","currentLocaleName","l","dropdownOpen","ref","wrapperRef","toggleDropdown","event","localeLabel","localeItem","currentLocaleLabel","current","handleSwitchLocale","code","nextTick","newPath","wrapperStyle","buttonStyle","dropdownStyle","itemStyle","linkStyle","activeLinkStyle","iconStyle","openIconStyle","normalizeSlot","slotResult","handleClickOutside","target","isClickInside","isButtonClick","onMounted","onUnmounted","children","buttonContent","dropdownItems","itemChildren","linkContent","result","routeTo","I18nT","attrs","options","route","numberValue","formattedNumber","translation","formattedDate","formattedRelativeDate","count","k","p","dv","lastIndex","slotName","slotFn","placeholder","index","useI18n","router","injectedDefaultLocale","defaultLocale","resolveLocalePath","to","localeCode","val","locale","newLocale","useLocaleHead","addDirAttribute","identifierAttribute","addSeoAttributes","baseUrl","getLocale","getLocales","i18nLocaleRoute","metaObject","filterQuery","fullPath","whitelist","url","filtered","filteredParams","updateMeta","canonicalQueryWhitelist","allLocales","currentLocaleObj","loc","currentIso","currentOg","currentDir","pathSegments","matchedLocale","localizedPath","canonicalPath","ogUrl","baseUrlValue","localePrefix","alternateLocales","ogLocaleMeta","ogUrlMeta","alternateOgLocalesMeta","ogAlt","canonicalLink","alternateLinks","switchedPathResult","switchedPath","href","links","xDefaultLink","defaultLocObj","defaultPathResult","defaultPath","xDefaultHref","VueI18n","BaseI18n","storage","shallowRef","lang","msgs","routeName","translations","merge","cb","value","createI18n","routingStrategy","i18nOptions","currentApp","currentStrategy","strategy","app","defaultValue","createVueRouterAdapter","localeCodes","resolvePath","first","cleanPath","RouterLink"],"mappings":"6JAKaA,SAAiD,MAAM,EACvDC,SAAgD,cAAc,EAC9DC,SAAoD,qBAAqB,EACzEC,SAA0D,sBAAsB,ECEhFC,EAAYC,EAAAA,gBAAgC,CACvD,KAAM,YACN,MAAO,CACL,OAAQ,CACN,KAAM,OACN,SAAU,EAAA,EAEZ,WAAY,CACV,KAAM,OACN,QAAS,EAAA,CACX,EAEF,MAAMC,EAAO,CAAE,MAAAC,GAAS,CACtB,MAAMC,EAAOC,EAAAA,OAAgBT,CAAgB,EAE7C,GAAI,CAACQ,EACH,MAAM,IAAI,MAAM,sFAAsF,EAGxG,MAAME,EAAY,CAACC,EAAaC,IAGvBJ,EAAK,EAAE,GAAGF,EAAM,MAAM,IAAIK,CAAG,GAAsBC,EAAQ,OAAWJ,EAAK,SAAA,CAAU,EAG9F,MAAO,IACLK,EAAAA,EACE,MACA,CACE,MAAO,CAAC,aAAcP,EAAM,UAAU,CAAA,EAExCC,EAAM,UAAU,CAAE,OAAQD,EAAM,OAAQ,EAAGI,EAAW,CAAA,CAE5D,CACF,CAAC,ECvCYI,EAAWT,EAAAA,gBAAgB,CACtC,KAAM,WACN,MAAO,CACL,GAAI,CACF,KAAM,CAAC,OAAQ,MAAM,EACrB,SAAU,EAAA,EAEZ,YAAa,CACX,KAAM,OACN,QAAS,KAAO,CAAA,EAAC,EAEnB,YAAa,CACX,KAAM,SACN,QAAS,MAAA,CACX,EAEF,MAAMC,EAAO,CAAE,MAAAC,GAAS,CACtB,MAAMC,EAAOC,EAAAA,OAAgBT,CAAg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,EAK3CgD,EAAc,CAACxE,EAAgCG,IAA2B,CAE9E,MAAMyB,GADO,OAAO5B,GAAO,SAAWA,EAAKA,EAAG,MAAQ,KAC5B,MAAM,GAAG,EAAE,OAAO,OAAO,EAG7CyE,EAAQ7C,EAAa,CAAC,EACxB6C,IAAU,QAAaF,EAAY,SAASE,CAAK,GACnD7C,EAAa,MAAA,EAGf,MAAM8C,EAAY,IAAI9C,EAAa,KAAK,GAAG,CAAC,GAG5C,OAAIzB,IAAWL,EACN4E,EAIF,IAAIvE,CAAM,GAAGuE,IAAc,IAAM,GAAKA,CAAS,EACxD,EAEA,MAAO,CACL,cAAeC,EAAAA,WAEf,eAAgB,IAEP/E,EAAO,aAAa,MAAM,KAGnC,KAAO/B,GAA6B,CAClC+B,EAAO,KAAK/B,EAAO,IAAI,EAAE,MAAM,IAAM,CAAC,CAAC,CACzC,EAEA,QAAUA,GAA6B,CACrC+B,EAAO,QAAQ/B,EAAO,IAAI,EAAE,MAAM,IAAM,CAAC,CAAC,CAC5C,EAEA,YAAa,CAACmC,EAAgCG,IAAmBqE,EAAYxE,EAAIG,CAAM,EAEvF,SAAU,KAAO,CACf,SAAUP,EAAO,aAAa,MAAM,SACpC,MAAOA,EAAO,aAAa,MAAM,KAAA,EACnC,CAEJ"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/injection.ts","../src/components/i18n-group.ts","../src/components/i18n-link.ts","../src/components/i18n-switcher.ts","../src/components/i18n-t.ts","../../utils/dist/resolve-og-locale.mjs","../src/use-i18n.ts","../src/composables/use-locale-head.ts","../src/composer.ts","../src/plugin.ts","../src/router/adapter.ts"],"sourcesContent":["import type { Locale } from '@i18n-micro/types'\nimport type { InjectionKey } from 'vue'\nimport type { VueI18n } from './composer'\nimport type { I18nRoutingStrategy } from './router/types'\n\nexport const I18nInjectionKey: InjectionKey<VueI18n> = Symbol('i18n')\nexport const I18nLocalesKey: InjectionKey<Locale[]> = Symbol('i18n-locales')\nexport const I18nDefaultLocaleKey: InjectionKey<string> = Symbol('i18n-default-locale')\nexport const I18nRouterKey: InjectionKey<I18nRoutingStrategy> = Symbol('i18n-router-strategy')\n","import type { TranslationKey } from '@i18n-micro/types'\nimport { defineComponent, h, inject } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey } from '../injection'\n\ninterface I18nGroupProps {\n prefix: string\n groupClass?: string\n}\n\nexport const I18nGroup = defineComponent<I18nGroupProps>({\n name: 'I18nGroup',\n props: {\n prefix: {\n type: String,\n required: true,\n },\n groupClass: {\n type: String,\n default: '',\n },\n },\n setup(props, { slots }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nGroup: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n const translate = (key: string, params?: Record<string, string | number | boolean>) => {\n // Use type assertion for dynamic keys with prefix\n // The developer is responsible for ensuring the key exists\n return i18n.t(`${props.prefix}.${key}` as TranslationKey, params, undefined, i18n.getRoute())\n }\n\n return () =>\n h(\n 'div',\n {\n class: ['i18n-group', props.groupClass],\n },\n slots.default?.({ prefix: props.prefix, t: translate }),\n )\n },\n})\n","import { type CSSProperties, computed, defineComponent, h, inject, type PropType } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey, I18nRouterKey } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\n\nexport const I18nLink = defineComponent({\n name: 'I18nLink',\n props: {\n to: {\n type: [String, Object] as PropType<string | { path?: string }>,\n required: true,\n },\n activeStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n localeRoute: {\n type: Function as PropType<(to: string | { path?: string }, locale?: string) => string | { path?: string }>,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n const routerStrategy = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nLink: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n const isExternalLink = computed(() => {\n if (typeof props.to === 'string') {\n return /^(?:https?:\\/\\/|\\/\\/|[a-zA-Z0-9-]+\\.[a-zA-Z]{2,})|tel:|mailto:/.test(props.to)\n }\n return false\n })\n\n const targetPath = computed(() => {\n if (isExternalLink.value) {\n return props.to as string\n }\n\n if (props.localeRoute) {\n const res = props.localeRoute(props.to)\n return typeof res === 'string' ? res : res.path || '/'\n }\n\n if (!routerStrategy?.resolvePath) {\n return typeof props.to === 'string' ? props.to : props.to.path || '/'\n }\n\n const res = routerStrategy.resolvePath(props.to, i18n.locale.value)\n return typeof res === 'string' ? res : res.path || '/'\n })\n\n const isActive = computed(() => {\n if (isExternalLink.value || !routerStrategy) {\n return false\n }\n\n const currentPath = routerStrategy.getCurrentPath().replace(/\\/$/, '')\n const linkPath = targetPath.value.replace(/\\/$/, '')\n\n return currentPath === linkPath\n })\n\n const computedStyle = computed(() => (isActive.value ? props.activeStyle : {}))\n\n return () => {\n if (isExternalLink.value) {\n return h(\n 'a',\n {\n href: targetPath.value,\n target: '_blank',\n rel: 'noopener noreferrer',\n style: computedStyle.value,\n },\n slots.default?.(),\n )\n }\n\n if (routerStrategy?.linkComponent) {\n return h(\n routerStrategy.linkComponent,\n {\n to: targetPath.value,\n style: computedStyle.value,\n },\n { default: slots.default },\n )\n }\n\n return h(\n 'a',\n {\n href: targetPath.value,\n style: computedStyle.value,\n onClick: (e: MouseEvent) => {\n e.preventDefault()\n if (routerStrategy) {\n routerStrategy.push({ path: targetPath.value })\n } else {\n window.location.href = targetPath.value\n }\n },\n },\n slots.default?.(),\n )\n }\n },\n})\n","import type { Locale } from '@i18n-micro/types'\nimport { type CSSProperties, computed, defineComponent, h, inject, nextTick, onMounted, onUnmounted, type PropType, ref, type VNode } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey, I18nLocalesKey, I18nRouterKey } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\n\nexport const I18nSwitcher = defineComponent({\n name: 'I18nSwitcher',\n props: {\n customLabels: {\n type: Object as PropType<Record<string, string>>,\n default: () => ({}),\n },\n customWrapperStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customButtonStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customDropdownStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customItemStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customLinkStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customActiveLinkStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n /**\n * Inline style applied to the switcher button when the *current* locale is\n * marked as `disabled: true` in the locale config.\n *\n * Note: disabled locales are omitted from the dropdown list, but the current\n * locale label is still shown on the button.\n */\n customDisabledLinkStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n customIconStyle: {\n type: Object as PropType<CSSProperties>,\n default: () => ({}),\n },\n locales: {\n type: Array as PropType<Locale[]>,\n default: undefined,\n },\n currentLocale: {\n type: [String, Function] as PropType<string | (() => string)>,\n default: undefined,\n },\n getLocaleName: {\n type: Function as PropType<() => string | null>,\n default: undefined,\n },\n switchLocale: {\n type: Function as PropType<(locale: string) => void>,\n default: undefined,\n },\n localeRoute: {\n type: Function as PropType<(to: string | { path?: string }, locale?: string) => string | { path?: string }>,\n default: undefined,\n },\n },\n setup(props, { slots }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n const routerStrategy = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n const injectedLocales = inject<Locale[] | undefined>(I18nLocalesKey, undefined)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nSwitcher: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n if (!injectedLocales && !props.locales) {\n throw new Error(\n '[i18n-micro] I18nSwitcher: locales not provided. Make sure app.provide(I18nLocalesKey, locales) is called or pass locales prop.',\n )\n }\n\n const allLocales = computed(() => props.locales || injectedLocales || [])\n const locales = computed(() => allLocales.value.filter((locale) => !locale.disabled))\n const currentLocale = computed(() => {\n if (props.currentLocale !== undefined) {\n return typeof props.currentLocale === 'function' ? props.currentLocale() : props.currentLocale\n }\n return i18n.locale.value\n })\n const currentLocaleDisabled = computed(() => allLocales.value.some((l) => l.code === currentLocale.value && l.disabled))\n const currentLocaleName = computed(() => {\n if (props.getLocaleName) {\n return props.getLocaleName() || null\n }\n // Use `allLocales` (not dropdown-only `locales`) so disabled locales still resolve\n // displayName/customLabels for the currently active button.\n const current = allLocales.value.find((l) => l.code === i18n.locale.value)\n return current?.displayName || null\n })\n\n const dropdownOpen = ref(false)\n const wrapperRef = ref<HTMLElement | null>(null)\n\n const toggleDropdown = (event?: Event) => {\n if (event) {\n event.stopPropagation()\n event.preventDefault()\n }\n dropdownOpen.value = !dropdownOpen.value\n }\n\n const localeLabel = (localeItem: Locale) => {\n const current = props.customLabels[localeItem.code] || localeItem.displayName\n return current || localeItem.code\n }\n\n const currentLocaleLabel = computed(() => {\n const current = allLocales.value.find((l) => l.code === currentLocale.value)\n return current ? localeLabel(current) : currentLocaleName.value || currentLocale.value\n })\n\n const handleSwitchLocale = async (code: string) => {\n dropdownOpen.value = false\n await nextTick()\n\n if (props.switchLocale) {\n props.switchLocale(code)\n return\n }\n\n i18n.locale.value = code\n\n if (!routerStrategy) {\n return\n }\n\n const currentPath = routerStrategy.getCurrentPath()\n const newPath = props.localeRoute\n ? (() => {\n const res = props.localeRoute(currentPath, code)\n return typeof res === 'string' ? res : res.path || '/'\n })()\n : routerStrategy?.resolvePath\n ? (() => {\n const res = routerStrategy.resolvePath(currentPath, code)\n return typeof res === 'string' ? res : res.path || '/'\n })()\n : currentPath\n\n routerStrategy.push({ path: newPath })\n }\n\n // Default Styles\n const wrapperStyle: CSSProperties = {\n position: 'relative',\n display: 'inline-block',\n verticalAlign: 'middle',\n }\n\n const buttonStyle: CSSProperties = {\n padding: '4px 12px',\n fontSize: '16px',\n cursor: 'pointer',\n backgroundColor: '#fff',\n border: '1px solid #333',\n transition: 'background-color 0.3s ease',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }\n\n const dropdownStyle: CSSProperties = {\n position: 'absolute',\n top: '100%',\n left: '0',\n zIndex: 1000,\n backgroundColor: '#fff',\n border: '1px solid #333',\n listStyle: 'none',\n padding: '0',\n margin: '4px 0 0 0',\n minWidth: '150px',\n boxShadow: '0 2px 8px rgba(0,0,0,0.15)',\n }\n\n const itemStyle: CSSProperties = {\n margin: '0',\n padding: '0',\n }\n\n const linkStyle: CSSProperties = {\n display: 'block',\n padding: '8px 12px',\n color: '#333',\n textDecoration: 'none',\n transition: 'background-color 0.3s ease',\n cursor: 'pointer',\n }\n\n const activeLinkStyle: CSSProperties = {\n fontWeight: 'bold',\n color: '#007bff',\n // Current locale is not a meaningful switch target\n cursor: 'not-allowed',\n }\n\n const iconStyle: CSSProperties = {\n marginLeft: '8px',\n display: 'inline-block',\n transition: 'transform 0.3s ease',\n }\n\n const openIconStyle: CSSProperties = {\n transform: 'rotate(180deg)',\n }\n\n const normalizeSlot = (slotResult: unknown): (VNode | string)[] => {\n if (!slotResult) return []\n return Array.isArray(slotResult) ? slotResult : [slotResult as VNode]\n }\n\n // Simplified and reliable outside click logic\n const handleClickOutside = (event: MouseEvent) => {\n if (!dropdownOpen.value) return\n\n const target = event.target as HTMLElement\n if (!target || !wrapperRef.value) return\n\n // Check that the click is not inside our wrapper\n const isClickInside = wrapperRef.value.contains(target)\n\n // Also check if the target is the switcher button\n const isButtonClick = target.closest('.i18n-switcher-button') !== null\n\n if (!isClickInside && !isButtonClick) {\n dropdownOpen.value = false\n }\n }\n\n onMounted(() => {\n // Use regular bubbling, but with a slight delay to give the dropdown time to open\n document.addEventListener('click', handleClickOutside)\n })\n\n onUnmounted(() => {\n document.removeEventListener('click', handleClickOutside)\n })\n\n return () => {\n const children: (VNode | string)[] = []\n\n // 1. Button rendering\n if (slots['before-button']) {\n children.push(...normalizeSlot(slots['before-button']()))\n }\n\n const buttonContent: (VNode | string)[] = []\n if (slots['before-selected-locale']) {\n buttonContent.push(...normalizeSlot(slots['before-selected-locale']()))\n }\n\n buttonContent.push(h('span', currentLocaleLabel.value))\n\n if (slots['after-selected-locale']) {\n buttonContent.push(...normalizeSlot(slots['after-selected-locale']()))\n }\n\n buttonContent.push(\n h(\n 'span',\n {\n style: {\n ...iconStyle,\n ...(dropdownOpen.value ? openIconStyle : {}),\n ...props.customIconStyle,\n },\n },\n '▼',\n ),\n )\n\n children.push(\n h(\n 'button',\n {\n class: 'i18n-switcher-button',\n style: {\n ...buttonStyle,\n ...props.customButtonStyle,\n ...(currentLocaleDisabled.value ? props.customDisabledLinkStyle : {}),\n },\n onClick: (e: MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDropdown(e)\n },\n type: 'button',\n ariaHaspopup: true,\n ariaExpanded: dropdownOpen.value,\n },\n buttonContent,\n ),\n )\n\n // 2. Dropdown rendering\n if (slots['before-dropdown']) {\n children.push(...normalizeSlot(slots['before-dropdown']()))\n }\n\n if (dropdownOpen.value) {\n const dropdownItems: VNode[] = []\n\n if (slots['before-dropdown-items']) {\n dropdownItems.push(...(normalizeSlot(slots['before-dropdown-items']()) as VNode[]))\n }\n\n locales.value.forEach((localeItem) => {\n const itemChildren: (VNode | string)[] = []\n\n if (slots['before-item']) {\n itemChildren.push(...normalizeSlot(slots['before-item']({ locale: localeItem })))\n }\n\n const linkContent: (VNode | string)[] = []\n if (slots['before-link-content']) {\n linkContent.push(...normalizeSlot(slots['before-link-content']({ locale: localeItem })))\n }\n linkContent.push(localeLabel(localeItem))\n if (slots['after-link-content']) {\n linkContent.push(...normalizeSlot(slots['after-link-content']({ locale: localeItem })))\n }\n\n const currentPath = typeof window !== 'undefined' ? window.location.pathname : '/'\n const result = props.localeRoute\n ? props.localeRoute(currentPath, localeItem.code)\n : routerStrategy?.resolvePath\n ? routerStrategy.resolvePath(currentPath, localeItem.code)\n : currentPath\n const routeTo = typeof result === 'string' ? result : result.path || '#'\n const isActive = localeItem.code === currentLocale.value\n\n itemChildren.push(\n h(\n 'a',\n {\n class: `switcher-locale-${localeItem.code}`,\n href: typeof routeTo === 'string' ? routeTo : '#',\n style: {\n ...linkStyle,\n ...(isActive ? activeLinkStyle : {}),\n ...props.customLinkStyle,\n // active-specific customization wins over the generic link style\n // (matches the React/Preact/Solid switchers)\n ...(isActive ? props.customActiveLinkStyle : {}),\n },\n // Prevent default navigation, use only handleSwitchLocale\n onClick: (e: MouseEvent) => {\n e.preventDefault()\n e.stopPropagation()\n handleSwitchLocale(localeItem.code)\n },\n },\n linkContent,\n ),\n )\n\n if (slots['after-item']) {\n itemChildren.push(...normalizeSlot(slots['after-item']({ locale: localeItem })))\n }\n\n dropdownItems.push(\n h(\n 'li',\n {\n key: localeItem.code,\n style: { ...itemStyle, ...props.customItemStyle },\n },\n itemChildren,\n ),\n )\n })\n\n if (slots['after-dropdown-items']) {\n dropdownItems.push(...(normalizeSlot(slots['after-dropdown-items']()) as VNode[]))\n }\n\n // Render UL right here, WITHOUT Teleport\n children.push(\n h(\n 'ul',\n {\n class: 'i18n-switcher-dropdown',\n style: { ...dropdownStyle, ...props.customDropdownStyle },\n },\n dropdownItems,\n ),\n )\n }\n\n if (slots['after-dropdown']) {\n children.push(...normalizeSlot(slots['after-dropdown']()))\n }\n\n // Return wrapper with ref\n return h(\n 'div',\n {\n ref: wrapperRef,\n class: 'i18n-switcher-wrapper',\n style: { ...wrapperStyle, ...props.customWrapperStyle },\n },\n children,\n )\n }\n },\n})\n","import type { PluralFunc, TranslationKey } from '@i18n-micro/types'\nimport { defineComponent, h, inject, type PropType, type VNode } from 'vue'\nimport type { VueI18n } from '../composer'\nimport { I18nInjectionKey } from '../injection'\n\nexport const I18nT = defineComponent({\n name: 'I18nT',\n props: {\n keypath: {\n type: String as PropType<TranslationKey>,\n required: true,\n },\n plural: {\n type: [Number, String] as PropType<number | string>,\n },\n tag: {\n type: String as PropType<string>,\n default: 'span',\n },\n params: {\n type: Object as PropType<Record<string, string | number | boolean>>,\n default: () => ({}),\n },\n defaultValue: {\n type: String as PropType<string>,\n default: '',\n },\n html: {\n type: Boolean as PropType<boolean>,\n default: false,\n },\n hideIfEmpty: {\n type: Boolean as PropType<boolean>,\n default: false,\n },\n customPluralRule: {\n type: Function as PropType<PluralFunc>,\n default: null,\n },\n number: {\n type: [Number, String] as PropType<number | string>,\n },\n date: {\n type: [Date, String, Number] as PropType<Date | string | number>,\n },\n relativeDate: {\n type: [Date, String, Number] as PropType<Date | string | number>,\n },\n },\n setup(props, { slots, attrs }) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n\n if (!i18n) {\n throw new Error('[i18n-micro] I18nT: i18n instance not found. Make sure i18n plugin is installed.')\n }\n\n return () => {\n const options: Record<string, string | number | boolean> = {}\n const route = i18n.getRoute()\n\n // Handle number formatting\n if (props.number !== undefined) {\n const numberValue = Number(props.number)\n const formattedNumber = i18n.tn(numberValue)\n const translation = i18n.t(props.keypath, { number: formattedNumber, ...props.params }, undefined, route)\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle date formatting\n if (props.date !== undefined) {\n const formattedDate = i18n.td(props.date)\n const translation = i18n.t(props.keypath, { date: formattedDate, ...props.params }, undefined, route)\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle relative date formatting\n if (props.relativeDate !== undefined) {\n const formattedRelativeDate = i18n.tdr(props.relativeDate)\n const translation = i18n.t(props.keypath, { relativeDate: formattedRelativeDate, ...props.params }, undefined, route)\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle pluralization\n if (props.plural !== undefined) {\n const count = Number.parseInt(props.plural.toString(), 10)\n if (props.customPluralRule) {\n const translation = props.customPluralRule(\n props.keypath,\n count,\n props.params,\n i18n.locale.value,\n (k: TranslationKey, p?: Record<string, string | number | boolean>, dv?: string) => i18n.t(k, p, dv, route),\n )\n return h(props.tag, { ...attrs, innerHTML: translation || '' })\n } else {\n const translation = i18n.tc(props.keypath, { count, ...props.params })\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n }\n\n // Regular translation\n const translation = (i18n.t(props.keypath, { ...props.params, ...options }, undefined, route) ?? '').toString()\n\n if (props.hideIfEmpty && !translation.trim()) {\n return props.defaultValue ?? null\n }\n\n if (props.html) {\n return h(props.tag, { ...attrs, innerHTML: translation })\n }\n\n // Handle slots\n if (slots.default) {\n return h(props.tag, attrs, slots.default({ translation }))\n }\n\n // Handle named slots for interpolation\n const children: (string | VNode)[] = []\n let lastIndex = 0\n\n for (const [slotName, slotFn] of Object.entries(slots)) {\n if (slotName === 'default') continue\n\n const placeholder = `{${slotName}}`\n const index = translation.indexOf(placeholder, lastIndex)\n\n if (index !== -1) {\n if (index > lastIndex) {\n children.push(translation.slice(lastIndex, index))\n }\n\n if (slotFn) {\n children.push(h(slotFn))\n }\n\n lastIndex = index + placeholder.length\n }\n }\n\n if (lastIndex < translation.length) {\n children.push(translation.slice(lastIndex))\n }\n\n if (slots.default) {\n return h(props.tag, attrs, slots.default({ children }))\n }\n\n if (children.length > 0) {\n return h(props.tag, attrs, children)\n }\n\n return h(props.tag, attrs, translation)\n }\n },\n})\n","function c(n) {\n const t = n.og?.trim();\n if (t) return t;\n const e = n.iso?.trim();\n if (!e) return null;\n const r = e.indexOf(\"_\");\n if (r > 0) {\n const s = e.slice(0, r), o = e.slice(r + 1);\n if (s.length >= 2 && o.length === 2)\n return `${s.toLowerCase()}_${o.toUpperCase()}`;\n }\n const i = e.indexOf(\"-\");\n if (i > 0) {\n const s = e.slice(0, i), o = e.slice(i + 1);\n if (s.length >= 2 && o.length === 2 && /^[A-Za-z]{2}$/.test(o))\n return `${s.toLowerCase()}_${o.toUpperCase()}`;\n }\n return null;\n}\nfunction l(n, t = {}) {\n if (c(n) !== null || t.missingWarn === !1 || process.env.NODE_ENV === \"production\") return;\n const e = t.tag ?? \"og:locale\", r = String(n.code ?? \"unknown\"), i = n.iso ? `, iso: '${n.iso}'` : \"\";\n console.warn(\n `[i18n] Cannot derive ${e} for locale '${r}'${i}. Set locale.og (e.g. 'en_US') or use iso with a 2-letter region (e.g. 'en-US').`\n );\n}\nexport {\n c as resolveOgLocale,\n l as warnUnresolvedOgLocale\n};\n","import type { Locale } from '@i18n-micro/types'\nimport { computed, inject } from 'vue'\nimport type { VueI18n } from './composer'\nimport { I18nDefaultLocaleKey, I18nInjectionKey, I18nLocalesKey, I18nRouterKey } from './injection'\nimport type { I18nRoutingStrategy } from './router/types'\n\nexport interface UseI18nOptions {\n locales?: Locale[]\n defaultLocale?: string\n}\n\n/**\n * Get the i18n instance from the Vue app context\n * Returns the same instance that was created with createI18n()\n */\nexport function useI18n(options?: UseI18nOptions) {\n const i18n = inject<VueI18n>(I18nInjectionKey)\n const router = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n const injectedLocales = inject<Locale[] | undefined>(I18nLocalesKey, undefined)\n const injectedDefaultLocale = inject<string | undefined>(I18nDefaultLocaleKey, undefined)\n\n if (!i18n) {\n throw new Error('[i18n-micro] useI18n() must be called after app.use(i18n). Make sure i18n plugin is installed.')\n }\n\n if (!injectedLocales) {\n throw new Error('[i18n-micro] I18nLocalesKey not provided. Make sure app.provide(I18nLocalesKey, locales) is called.')\n }\n\n if (!injectedDefaultLocale) {\n throw new Error('[i18n-micro] I18nDefaultLocaleKey not provided. Make sure app.provide(I18nDefaultLocaleKey, defaultLocale) is called.')\n }\n\n const locales = options?.locales || injectedLocales\n const defaultLocale = options?.defaultLocale || injectedDefaultLocale\n\n const resolveLocalePath = (to: string | { path?: string }, localeCode?: string): string | { path?: string } => {\n if (!router?.resolvePath) {\n return to\n }\n return router.resolvePath(to, localeCode || i18n.locale.value)\n }\n\n return {\n // Direct access to instance\n instance: i18n,\n\n // Locale (reactive)\n locale: computed({\n get: () => i18n.locale.value,\n set: (val: string) => {\n i18n.locale.value = val\n },\n }),\n\n // Locale helpers\n getLocales: () => locales,\n defaultLocale: () => defaultLocale,\n getLocaleName: () => {\n const current = locales.find((l) => l.code === i18n.locale.value)\n return current?.displayName || null\n },\n\n // Routing helpers\n localeRoute: resolveLocalePath,\n localePath: (to: string | { path?: string }, locale?: string): string => {\n const res = resolveLocalePath(to, locale)\n return typeof res === 'string' ? res : res.path || '/'\n },\n switchLocale: (newLocale: string) => {\n i18n.locale.value = newLocale\n if (router) {\n const currentPath = router.getCurrentPath()\n const newPath = resolveLocalePath(currentPath, newLocale)\n router.push(typeof newPath === 'string' ? { path: newPath } : { path: newPath.path || '/' })\n }\n },\n\n // Translation methods (delegate to instance)\n t: i18n.t.bind(i18n),\n ts: i18n.ts.bind(i18n),\n tc: i18n.tc.bind(i18n),\n tn: i18n.tn.bind(i18n),\n td: i18n.td.bind(i18n),\n tdr: i18n.tdr.bind(i18n),\n has: i18n.has.bind(i18n),\n resolveTranslations: i18n.resolveTranslations.bind(i18n),\n setTranslation: i18n.setTranslation.bind(i18n),\n\n // Route management\n setRoute: i18n.setRoute.bind(i18n),\n getRoute: i18n.getRoute.bind(i18n),\n getLocale: () => i18n.locale.value,\n\n // Translation management\n addTranslations: i18n.addTranslations.bind(i18n),\n addRouteTranslations: i18n.addRouteTranslations.bind(i18n),\n mergeTranslations: i18n.mergeTranslations.bind(i18n),\n clearCache: i18n.clearCache.bind(i18n),\n }\n}\n","import type { Locale } from '@i18n-micro/types'\nimport { resolveOgLocale, warnUnresolvedOgLocale } from '@i18n-micro/utils/resolve-og-locale'\nimport { inject, ref } from 'vue'\nimport { I18nDefaultLocaleKey, I18nRouterKey } from '../injection'\nimport type { I18nRoutingStrategy } from '../router/types'\nimport { useI18n } from '../use-i18n'\n\ninterface MetaLink {\n [key: string]: string | undefined\n rel: string\n href: string\n hreflang?: string\n}\n\ninterface MetaTag {\n [key: string]: string\n property: string\n content: string\n}\n\ninterface MetaObject {\n htmlAttrs: {\n lang?: string\n dir?: 'ltr' | 'rtl' | 'auto'\n }\n link: MetaLink[]\n meta: MetaTag[]\n}\n\nexport interface UseLocaleHeadOptions {\n addDirAttribute?: boolean\n identifierAttribute?: string\n addSeoAttributes?: boolean\n baseUrl?: string | (() => string)\n}\n\nexport function useLocaleHead(options: UseLocaleHeadOptions = {}) {\n const { addDirAttribute = true, identifierAttribute = 'id', addSeoAttributes = true, baseUrl = '/' } = options\n\n const { getLocale, getLocales, localeRoute: i18nLocaleRoute } = useI18n()\n const routerStrategy = inject<I18nRoutingStrategy | undefined>(I18nRouterKey, undefined)\n\n const metaObject = ref<MetaObject>({\n htmlAttrs: {},\n link: [],\n meta: [],\n })\n\n function filterQuery(fullPath: string, whitelist: string[]): string {\n const url = new URL(fullPath, 'http://localhost')\n const params = new URLSearchParams(url.search)\n const filtered: Record<string, string> = {}\n for (const key of whitelist) {\n if (params.has(key)) {\n filtered[key] = params.get(key) as string\n }\n }\n const filteredParams = new URLSearchParams(filtered)\n return filteredParams.toString() ? `${url.pathname}?${filteredParams.toString()}` : url.pathname\n }\n\n function updateMeta(canonicalQueryWhitelist: string[] = []) {\n if (!routerStrategy) {\n metaObject.value = { htmlAttrs: {}, link: [], meta: [] }\n return\n }\n\n const locale = getLocale()\n const allLocales = getLocales()\n const currentLocaleObj = allLocales.find((loc: Locale) => loc.code === locale)\n\n if (!currentLocaleObj) {\n return\n }\n\n const currentIso = currentLocaleObj.iso || locale\n const currentOg = resolveOgLocale(currentLocaleObj)\n const currentDir = currentLocaleObj.dir || 'auto'\n\n let fullPath = routerStrategy.getCurrentPath()\n if (!fullPath.startsWith('/')) {\n fullPath = `/${fullPath}`\n }\n\n const pathSegments = fullPath.split('/').filter(Boolean)\n const matchedLocale = allLocales.find((localeItem: Locale) => pathSegments[0] === localeItem.code)\n\n let localizedPath = fullPath\n let canonicalPath: string\n\n let ogUrl: string\n const baseUrlValue = typeof baseUrl === 'function' ? baseUrl() : baseUrl\n\n if (matchedLocale) {\n localizedPath = fullPath.slice(matchedLocale.code.length + 1) || '/'\n canonicalPath = filterQuery(localizedPath, canonicalQueryWhitelist)\n const localePrefix = `/${locale}`\n ogUrl = `${baseUrlValue}${localePrefix}${canonicalPath.startsWith('/') ? '' : '/'}${canonicalPath}`\n } else {\n canonicalPath = filterQuery(fullPath, canonicalQueryWhitelist)\n ogUrl = `${baseUrlValue}${canonicalPath.startsWith('/') ? '' : '/'}${canonicalPath}`\n }\n\n const htmlAttrs = {\n lang: currentIso,\n ...(addDirAttribute ? { dir: currentDir } : {}),\n }\n\n if (!addSeoAttributes) {\n metaObject.value = { htmlAttrs, link: [], meta: [] }\n return\n }\n\n const alternateLocales = allLocales.filter((loc: Locale) => !loc.disabled && loc.seo !== false)\n\n if (!currentOg) {\n warnUnresolvedOgLocale(currentLocaleObj, { tag: 'og:locale' })\n }\n\n const ogLocaleMeta: MetaTag | null = currentOg\n ? {\n [identifierAttribute]: 'i18n-og',\n property: 'og:locale',\n content: currentOg,\n }\n : null\n\n const ogUrlMeta: MetaTag = {\n [identifierAttribute]: 'i18n-og-url',\n property: 'og:url',\n content: ogUrl,\n }\n\n const alternateOgLocalesMeta = alternateLocales\n .filter((loc: Locale) => loc.code !== locale)\n .map((loc: Locale) => {\n const ogAlt = resolveOgLocale(loc)\n if (!ogAlt) {\n warnUnresolvedOgLocale(loc, { tag: 'og:locale:alternate' })\n return null\n }\n return {\n [identifierAttribute]: `i18n-og-alt-${ogAlt}`,\n property: 'og:locale:alternate',\n content: ogAlt,\n }\n })\n .filter((meta): meta is MetaTag => meta !== null)\n\n const canonicalLink: MetaLink = {\n [identifierAttribute]: 'i18n-can',\n rel: 'canonical',\n href: ogUrl,\n }\n\n const alternateLinks: MetaLink[] = alternateLocales.flatMap((loc: Locale) => {\n if (!i18nLocaleRoute || !routerStrategy) {\n return []\n }\n\n const currentPath = routerStrategy.getCurrentPath()\n // Use i18n's localeRoute which delegates to router strategy\n const switchedPathResult = i18nLocaleRoute(currentPath, loc.code)\n const switchedPath = typeof switchedPathResult === 'string' ? switchedPathResult : switchedPathResult?.path || '/'\n if (!switchedPath) {\n return []\n }\n\n let href: string\n if (switchedPath.startsWith('http://') || switchedPath.startsWith('https://')) {\n href = switchedPath\n } else {\n const baseUrlValue = typeof baseUrl === 'function' ? baseUrl() : baseUrl\n href = `${baseUrlValue}${switchedPath.startsWith('/') ? '' : '/'}${switchedPath}`\n }\n\n const links: MetaLink[] = [\n {\n [identifierAttribute]: `i18n-alternate-${loc.code}`,\n rel: 'alternate',\n href,\n hreflang: loc.code,\n },\n ]\n\n if (loc.iso && loc.iso !== loc.code) {\n links.push({\n [identifierAttribute]: `i18n-alternate-${loc.iso}`,\n rel: 'alternate',\n href,\n hreflang: loc.iso,\n })\n }\n\n return links\n })\n\n // Generate x-default hreflang link pointing to the default locale's URL.\n // x-default tells search engines which URL to show when none of the\n // specified languages match the user's browser settings.\n const injectedDefaultLocale = inject<string | undefined>(I18nDefaultLocaleKey, undefined)\n let xDefaultLink: MetaLink | null = null\n const defaultLocObj = injectedDefaultLocale ? allLocales.find((l: Locale) => l.code === injectedDefaultLocale) : undefined\n if (i18nLocaleRoute && routerStrategy && injectedDefaultLocale && defaultLocObj?.seo !== false) {\n const currentPath = routerStrategy.getCurrentPath()\n const defaultPathResult = i18nLocaleRoute(currentPath, injectedDefaultLocale)\n const defaultPath = typeof defaultPathResult === 'string' ? defaultPathResult : defaultPathResult?.path || '/'\n if (defaultPath) {\n let xDefaultHref: string\n if (defaultPath.startsWith('http://') || defaultPath.startsWith('https://')) {\n xDefaultHref = defaultPath\n } else {\n const baseUrlValue = typeof baseUrl === 'function' ? baseUrl() : baseUrl\n xDefaultHref = `${baseUrlValue}${defaultPath.startsWith('/') ? '' : '/'}${defaultPath}`\n }\n xDefaultLink = {\n [identifierAttribute]: 'i18n-xd',\n rel: 'alternate',\n href: xDefaultHref,\n hreflang: 'x-default',\n }\n }\n }\n\n metaObject.value = {\n htmlAttrs,\n meta: [...(ogLocaleMeta ? [ogLocaleMeta] : []), ogUrlMeta, ...alternateOgLocalesMeta],\n link: [canonicalLink, ...alternateLinks, ...(xDefaultLink ? [xDefaultLink] : [])],\n }\n }\n\n return {\n metaObject,\n updateMeta,\n }\n}\n","import { BaseI18n, type TranslationStorage } from '@i18n-micro/core'\nimport type { PluralFunc, Translations } from '@i18n-micro/types'\nimport { type Ref, shallowRef } from 'vue'\n\nexport interface VueI18nOptions {\n locale: string\n fallbackLocale?: string\n messages?: Record<string, Translations>\n plural?: PluralFunc\n missingWarn?: boolean\n missingHandler?: (locale: string, key: string, routeName: string) => void\n}\n\nexport class VueI18n extends BaseI18n {\n private _locale: Ref<string>\n private _fallbackLocale: Ref<string>\n private _currentRoute: Ref<string>\n private _revision: Ref<number>\n\n public readonly storage: TranslationStorage\n\n private listeners: Set<() => void> = new Set()\n\n constructor(options: VueI18nOptions) {\n const storage: TranslationStorage = {\n translations: new Map<string, Translations>(),\n }\n\n super({\n storage,\n plural: options.plural,\n missingWarn: options.missingWarn,\n missingHandler: options.missingHandler,\n })\n\n this.storage = storage\n this._locale = shallowRef(options.locale)\n this._fallbackLocale = shallowRef(options.fallbackLocale || options.locale)\n this._currentRoute = shallowRef('index')\n this._revision = shallowRef(0)\n\n if (options.messages) {\n for (const [lang, msgs] of Object.entries(options.messages)) {\n this.helper.loadTranslations(lang, msgs)\n }\n }\n }\n\n get locale(): Ref<string> {\n return this._locale\n }\n\n set locale(val: Ref<string> | string) {\n if (typeof val === 'string') {\n this._locale.value = val\n } else {\n this._locale = val\n }\n }\n\n get fallbackLocale(): Ref<string> {\n return this._fallbackLocale\n }\n\n set fallbackLocale(val: Ref<string> | string) {\n if (typeof val === 'string') {\n this._fallbackLocale.value = val\n } else {\n this._fallbackLocale = val\n }\n }\n\n get currentRoute(): Ref<string> {\n return this._currentRoute\n }\n\n setRoute(routeName: string): void {\n this._currentRoute.value = routeName\n }\n\n public getLocale(): string {\n return this._locale.value\n }\n\n public getFallbackLocale(): string {\n return this._fallbackLocale.value\n }\n\n public getRoute(): string {\n return this._currentRoute.value\n }\n\n public addTranslations(locale: string, translations: Translations, merge = true): void {\n super.loadTranslationsCore(locale, translations, merge)\n this._revision.value++\n this.notifyListeners()\n }\n\n public addRouteTranslations(locale: string, routeName: string, translations: Translations, merge = true): void {\n super.loadRouteTranslationsCore(locale, routeName, translations, merge)\n this._revision.value++\n this.notifyListeners()\n }\n\n public mergeTranslations(locale: string, routeName: string, translations: Translations): void {\n this.helper.mergeTranslation(locale, routeName, translations, true)\n this._revision.value++\n this.notifyListeners()\n }\n\n public override clearCache(): void {\n super.clearCache()\n this._revision.value++\n this.notifyListeners()\n }\n\n protected override onTranslationsChanged(): void {\n this._revision.value++\n this.notifyListeners()\n }\n\n public subscribeToChanges(cb: () => void): () => void {\n this.listeners.add(cb)\n return () => this.listeners.delete(cb)\n }\n\n private notifyListeners(): void {\n this.listeners.forEach((cb) => cb())\n }\n\n public getStorage(): TranslationStorage {\n return this.storage\n }\n\n public getRouteCache(): Record<string, Translations> {\n const result: Record<string, Translations> = {}\n for (const [key, value] of this.storage.translations) {\n result[key] = value\n }\n return result\n }\n}\n","import type { Locale, TranslationKey } from '@i18n-micro/types'\nimport type { App, Plugin } from 'vue'\nimport { I18nGroup } from './components/i18n-group'\nimport { I18nLink } from './components/i18n-link'\nimport { I18nSwitcher } from './components/i18n-switcher'\nimport { I18nT } from './components/i18n-t'\nimport { VueI18n, type VueI18nOptions } from './composer'\nimport { I18nDefaultLocaleKey, I18nInjectionKey, I18nLocalesKey, I18nRouterKey } from './injection'\nimport type { I18nRoutingStrategy } from './router/types'\n\nexport interface CreateI18nOptions extends VueI18nOptions {\n routingStrategy?: I18nRoutingStrategy\n /**\n * Array of locale configurations\n * If provided, will be automatically provided to the app via I18nLocalesKey\n */\n locales?: Locale[]\n /**\n * Default locale code\n * If provided, will be automatically provided to the app via I18nDefaultLocaleKey\n */\n defaultLocale?: string\n}\n\nexport type I18nPlugin = Plugin & {\n global: VueI18n\n setRoutingStrategy: (strategy: I18nRoutingStrategy) => void\n}\n\nexport function createI18n(options: CreateI18nOptions): I18nPlugin {\n const { routingStrategy, locales, defaultLocale, ...i18nOptions } = options\n const i18n = new VueI18n(i18nOptions)\n\n let currentApp: App | null = null\n let currentStrategy: I18nRoutingStrategy | null = routingStrategy || null\n\n const setRoutingStrategy = (strategy: I18nRoutingStrategy) => {\n currentStrategy = strategy\n if (currentApp) {\n currentApp.provide(I18nRouterKey, strategy)\n }\n }\n\n return {\n global: i18n, // Access to instance outside components\n setRoutingStrategy, // Method for setting adapter after creation\n install(app: App) {\n currentApp = app\n // 1. Provide for useI18n\n app.provide(I18nInjectionKey, i18n)\n\n // 2. Provide routing strategy if provided\n if (currentStrategy) {\n app.provide(I18nRouterKey, currentStrategy)\n }\n\n // 3. Automatically provide locales and defaultLocale if provided in options\n // This improves DX by eliminating the need for manual provide calls\n if (locales) {\n app.provide(I18nLocalesKey, locales)\n }\n if (defaultLocale) {\n app.provide(I18nDefaultLocaleKey, defaultLocale)\n }\n\n // 4. Global properties ($t, $tc, etc.)\n // Note: In templates, these may be called with string literals, so we use TranslationKey type\n app.config.globalProperties.$t = (\n key: TranslationKey,\n params?: Record<string, string | number | boolean>,\n defaultValue?: string | null,\n routeName?: string,\n ) => {\n return i18n.t(key, params, defaultValue, routeName)\n }\n app.config.globalProperties.$ts = (\n key: TranslationKey,\n params?: Record<string, string | number | boolean>,\n defaultValue?: string,\n routeName?: string,\n ) => {\n return i18n.ts(key, params, defaultValue, routeName)\n }\n app.config.globalProperties.$tc = (key: TranslationKey, count: number | Record<string, string | number | boolean>, defaultValue?: string) => {\n return i18n.tc(key, count, defaultValue)\n }\n app.config.globalProperties.$tn = i18n.tn.bind(i18n)\n app.config.globalProperties.$td = i18n.td.bind(i18n)\n app.config.globalProperties.$tdr = i18n.tdr.bind(i18n)\n app.config.globalProperties.$has = (key: TranslationKey, routeName?: string) => {\n return i18n.has(key, routeName)\n }\n // Provide access to i18n instance via $i18n\n // Using unknown and then casting to avoid any, but Vue's globalProperties requires flexibility\n app.config.globalProperties.$i18n = i18n as any\n\n // 5. Register components\n app.component('I18nT', I18nT)\n app.component('I18nLink', I18nLink)\n app.component('I18nGroup', I18nGroup)\n app.component('I18nSwitcher', I18nSwitcher)\n },\n }\n}\n","import type { Locale } from '@i18n-micro/types'\nimport type { Router } from 'vue-router'\nimport { RouterLink } from 'vue-router'\nimport type { I18nRoutingStrategy } from './types'\n\n/**\n * Factory for Vue Router adapter\n * Implements routing utilities for Vue Router\n * Uses vue-router APIs for navigation and path resolution\n */\nexport function createVueRouterAdapter(router: Router, locales: Locale[], defaultLocale: string): I18nRoutingStrategy {\n const localeCodes = locales.map((loc) => loc.code)\n\n /**\n * Path resolution logic (add prefix or not)\n */\n const resolvePath = (to: string | { path?: string }, locale: string): string => {\n const path = typeof to === 'string' ? to : to.path || '/'\n const pathSegments = path.split('/').filter(Boolean)\n\n // If path already starts with a locale, remove it\n const first = pathSegments[0]\n if (first !== undefined && localeCodes.includes(first)) {\n pathSegments.shift()\n }\n\n const cleanPath = `/${pathSegments.join('/')}`\n\n // If default locale - return clean path\n if (locale === defaultLocale) {\n return cleanPath\n }\n\n // Otherwise add prefix\n return `/${locale}${cleanPath === '/' ? '' : cleanPath}`\n }\n\n return {\n linkComponent: RouterLink,\n\n getCurrentPath: () => {\n // currentRoute in Vue Router is reactive\n return router.currentRoute.value.path\n },\n\n push: (target: { path: string }) => {\n router.push(target.path).catch(() => {})\n },\n\n replace: (target: { path: string }) => {\n router.replace(target.path).catch(() => {})\n },\n\n resolvePath: (to: string | { path?: string }, locale: string) => resolvePath(to, locale),\n\n getRoute: () => ({\n fullPath: router.currentRoute.value.fullPath,\n query: router.currentRoute.value.query,\n }),\n }\n}\n"],"names":["I18nInjectionKey","I18nLocalesKey","I18nDefaultLocaleKey","I18nRouterKey","I18nGroup","defineComponent","props","slots","i18n","inject","translate","key","params","h","I18nLink","routerStrategy","isExternalLink","computed","targetPath","res","isActive","currentPath","linkPath","computedStyle","e","I18nSwitcher","injectedLocales","allLocales","locales","locale","currentLocale","currentLocaleDisabled","l","currentLocaleName","dropdownOpen","ref","wrapperRef","toggleDropdown","event","localeLabel","localeItem","currentLocaleLabel","current","handleSwitchLocale","code","nextTick","newPath","wrapperStyle","buttonStyle","dropdownStyle","itemStyle","linkStyle","activeLinkStyle","iconStyle","openIconStyle","normalizeSlot","slotResult","handleClickOutside","target","isClickInside","isButtonClick","onMounted","onUnmounted","children","buttonContent","dropdownItems","itemChildren","linkContent","result","routeTo","I18nT","attrs","options","route","numberValue","formattedNumber","translation","formattedDate","formattedRelativeDate","count","k","p","dv","lastIndex","slotName","slotFn","placeholder","index","c","n","t","r","s","o","i","useI18n","router","injectedDefaultLocale","defaultLocale","resolveLocalePath","to","localeCode","val","newLocale","useLocaleHead","addDirAttribute","identifierAttribute","addSeoAttributes","baseUrl","getLocale","getLocales","i18nLocaleRoute","metaObject","filterQuery","fullPath","whitelist","url","filtered","filteredParams","updateMeta","canonicalQueryWhitelist","currentLocaleObj","loc","currentIso","currentOg","resolveOgLocale","currentDir","pathSegments","matchedLocale","localizedPath","canonicalPath","ogUrl","baseUrlValue","localePrefix","htmlAttrs","alternateLocales","warnUnresolvedOgLocale","ogLocaleMeta","ogUrlMeta","alternateOgLocalesMeta","ogAlt","meta","canonicalLink","alternateLinks","switchedPathResult","switchedPath","href","links","xDefaultLink","defaultLocObj","defaultPathResult","defaultPath","xDefaultHref","VueI18n","BaseI18n","storage","shallowRef","lang","msgs","routeName","translations","merge","cb","value","createI18n","routingStrategy","i18nOptions","currentApp","currentStrategy","strategy","app","defaultValue","createVueRouterAdapter","localeCodes","resolvePath","first","cleanPath","RouterLink"],"mappings":"8JAKaA,SAAiD,MAAM,EACvDC,SAAgD,cAAc,EAC9DC,SAAoD,qBAAqB,EACzEC,SAA0D,sBAAsB,ECEhFC,EAAYC,EAAAA,gBAAgC,CACvD,KAAM,YACN,MAAO,CACL,OAAQ,CACN,KAAM,OACN,SAAU,EAAA,EAEZ,WAAY,CACV,KAAM,OACN,QAAS,EAAA,CACX,EAEF,MAAMC,EAAO,CAAE,MAAAC,GAAS,CACtB,MAAMC,EAAOC,EAAAA,O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AEA,QAAUA,GAA6B,CACrCsC,EAAO,QAAQtC,EAAO,IAAI,EAAE,MAAM,IAAM,CAAC,CAAC,CAC5C,EAEA,YAAa,CAAC0C,EAAgCvE,IAAmBiJ,EAAY1E,EAAIvE,CAAM,EAEvF,SAAU,KAAO,CACf,SAAUmE,EAAO,aAAa,MAAM,SACpC,MAAOA,EAAO,aAAa,MAAM,KAAA,EACnC,CAEJ"}
|
package/dist/index.d.cts
CHANGED
|
@@ -198,6 +198,13 @@ customActiveLinkStyle: {
|
|
|
198
198
|
type: PropType<CSSProperties>;
|
|
199
199
|
default: () => {};
|
|
200
200
|
};
|
|
201
|
+
/**
|
|
202
|
+
* Inline style applied to the switcher button when the *current* locale is
|
|
203
|
+
* marked as `disabled: true` in the locale config.
|
|
204
|
+
*
|
|
205
|
+
* Note: disabled locales are omitted from the dropdown list, but the current
|
|
206
|
+
* locale label is still shown on the button.
|
|
207
|
+
*/
|
|
201
208
|
customDisabledLinkStyle: {
|
|
202
209
|
type: PropType<CSSProperties>;
|
|
203
210
|
default: () => {};
|
|
@@ -261,6 +268,13 @@ customActiveLinkStyle: {
|
|
|
261
268
|
type: PropType<CSSProperties>;
|
|
262
269
|
default: () => {};
|
|
263
270
|
};
|
|
271
|
+
/**
|
|
272
|
+
* Inline style applied to the switcher button when the *current* locale is
|
|
273
|
+
* marked as `disabled: true` in the locale config.
|
|
274
|
+
*
|
|
275
|
+
* Note: disabled locales are omitted from the dropdown list, but the current
|
|
276
|
+
* locale label is still shown on the button.
|
|
277
|
+
*/
|
|
264
278
|
customDisabledLinkStyle: {
|
|
265
279
|
type: PropType<CSSProperties>;
|
|
266
280
|
default: () => {};
|
|
@@ -460,13 +474,23 @@ export declare function useI18n(options?: UseI18nOptions): {
|
|
|
460
474
|
path?: string;
|
|
461
475
|
}, locale?: string) => string;
|
|
462
476
|
switchLocale: (newLocale: string) => void;
|
|
463
|
-
t: (key: TranslationKey, params?: Params, defaultValue?: string | null,
|
|
464
|
-
ts: (key: TranslationKey, params?: Params, defaultValue?: string,
|
|
477
|
+
t: (key: TranslationKey, params?: Params, defaultValue?: string | null, routeContext?: unknown) => CleanTranslation;
|
|
478
|
+
ts: (key: TranslationKey, params?: Params, defaultValue?: string, routeContext?: unknown) => string;
|
|
465
479
|
tc: (key: TranslationKey, count: number | Params, defaultValue?: string) => string;
|
|
466
|
-
tn:
|
|
467
|
-
|
|
480
|
+
tn: {
|
|
481
|
+
(value: number, options?: Intl.NumberFormatOptions): string;
|
|
482
|
+
(value: number, key: string, overrides?: Intl.NumberFormatOptions): string;
|
|
483
|
+
(value: number, key: string, locale: string, overrides?: Intl.NumberFormatOptions): string;
|
|
484
|
+
};
|
|
485
|
+
td: {
|
|
486
|
+
(value: Date | number | string, options?: Intl.DateTimeFormatOptions): string;
|
|
487
|
+
(value: Date | number | string, key: string, overrides?: Intl.DateTimeFormatOptions): string;
|
|
488
|
+
(value: Date | number | string, key: string, locale: string, overrides?: Intl.DateTimeFormatOptions): string;
|
|
489
|
+
};
|
|
468
490
|
tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string;
|
|
469
|
-
has: (key: TranslationKey,
|
|
491
|
+
has: (key: TranslationKey, routeContext?: unknown) => boolean;
|
|
492
|
+
resolveTranslations: (routeContext?: unknown) => Translations;
|
|
493
|
+
setTranslation: (key: TranslationKey, value: unknown) => void;
|
|
470
494
|
setRoute: (routeName: string) => void;
|
|
471
495
|
getRoute: () => string;
|
|
472
496
|
getLocale: () => string;
|
|
@@ -546,9 +570,9 @@ export declare class VueI18n extends BaseI18n {
|
|
|
546
570
|
addRouteTranslations(locale: string, routeName: string, translations: Translations, merge?: boolean): void;
|
|
547
571
|
mergeTranslations(locale: string, routeName: string, translations: Translations): void;
|
|
548
572
|
clearCache(): void;
|
|
573
|
+
protected onTranslationsChanged(): void;
|
|
549
574
|
subscribeToChanges(cb: () => void): () => void;
|
|
550
575
|
private notifyListeners;
|
|
551
|
-
getAllTranslations(): Record<string, Translations>;
|
|
552
576
|
getStorage(): TranslationStorage;
|
|
553
577
|
getRouteCache(): Record<string, Translations>;
|
|
554
578
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -198,6 +198,13 @@ customActiveLinkStyle: {
|
|
|
198
198
|
type: PropType<CSSProperties>;
|
|
199
199
|
default: () => {};
|
|
200
200
|
};
|
|
201
|
+
/**
|
|
202
|
+
* Inline style applied to the switcher button when the *current* locale is
|
|
203
|
+
* marked as `disabled: true` in the locale config.
|
|
204
|
+
*
|
|
205
|
+
* Note: disabled locales are omitted from the dropdown list, but the current
|
|
206
|
+
* locale label is still shown on the button.
|
|
207
|
+
*/
|
|
201
208
|
customDisabledLinkStyle: {
|
|
202
209
|
type: PropType<CSSProperties>;
|
|
203
210
|
default: () => {};
|
|
@@ -261,6 +268,13 @@ customActiveLinkStyle: {
|
|
|
261
268
|
type: PropType<CSSProperties>;
|
|
262
269
|
default: () => {};
|
|
263
270
|
};
|
|
271
|
+
/**
|
|
272
|
+
* Inline style applied to the switcher button when the *current* locale is
|
|
273
|
+
* marked as `disabled: true` in the locale config.
|
|
274
|
+
*
|
|
275
|
+
* Note: disabled locales are omitted from the dropdown list, but the current
|
|
276
|
+
* locale label is still shown on the button.
|
|
277
|
+
*/
|
|
264
278
|
customDisabledLinkStyle: {
|
|
265
279
|
type: PropType<CSSProperties>;
|
|
266
280
|
default: () => {};
|
|
@@ -460,13 +474,23 @@ export declare function useI18n(options?: UseI18nOptions): {
|
|
|
460
474
|
path?: string;
|
|
461
475
|
}, locale?: string) => string;
|
|
462
476
|
switchLocale: (newLocale: string) => void;
|
|
463
|
-
t: (key: TranslationKey, params?: Params, defaultValue?: string | null,
|
|
464
|
-
ts: (key: TranslationKey, params?: Params, defaultValue?: string,
|
|
477
|
+
t: (key: TranslationKey, params?: Params, defaultValue?: string | null, routeContext?: unknown) => CleanTranslation;
|
|
478
|
+
ts: (key: TranslationKey, params?: Params, defaultValue?: string, routeContext?: unknown) => string;
|
|
465
479
|
tc: (key: TranslationKey, count: number | Params, defaultValue?: string) => string;
|
|
466
|
-
tn:
|
|
467
|
-
|
|
480
|
+
tn: {
|
|
481
|
+
(value: number, options?: Intl.NumberFormatOptions): string;
|
|
482
|
+
(value: number, key: string, overrides?: Intl.NumberFormatOptions): string;
|
|
483
|
+
(value: number, key: string, locale: string, overrides?: Intl.NumberFormatOptions): string;
|
|
484
|
+
};
|
|
485
|
+
td: {
|
|
486
|
+
(value: Date | number | string, options?: Intl.DateTimeFormatOptions): string;
|
|
487
|
+
(value: Date | number | string, key: string, overrides?: Intl.DateTimeFormatOptions): string;
|
|
488
|
+
(value: Date | number | string, key: string, locale: string, overrides?: Intl.DateTimeFormatOptions): string;
|
|
489
|
+
};
|
|
468
490
|
tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string;
|
|
469
|
-
has: (key: TranslationKey,
|
|
491
|
+
has: (key: TranslationKey, routeContext?: unknown) => boolean;
|
|
492
|
+
resolveTranslations: (routeContext?: unknown) => Translations;
|
|
493
|
+
setTranslation: (key: TranslationKey, value: unknown) => void;
|
|
470
494
|
setRoute: (routeName: string) => void;
|
|
471
495
|
getRoute: () => string;
|
|
472
496
|
getLocale: () => string;
|
|
@@ -546,9 +570,9 @@ export declare class VueI18n extends BaseI18n {
|
|
|
546
570
|
addRouteTranslations(locale: string, routeName: string, translations: Translations, merge?: boolean): void;
|
|
547
571
|
mergeTranslations(locale: string, routeName: string, translations: Translations): void;
|
|
548
572
|
clearCache(): void;
|
|
573
|
+
protected onTranslationsChanged(): void;
|
|
549
574
|
subscribeToChanges(cb: () => void): () => void;
|
|
550
575
|
private notifyListeners;
|
|
551
|
-
getAllTranslations(): Record<string, Translations>;
|
|
552
576
|
getStorage(): TranslationStorage;
|
|
553
577
|
getRouteCache(): Record<string, Translations>;
|
|
554
578
|
}
|