1import{I as j,bj as D,C as g,J as L,O as m,aa as d,M as i,ab as s,aK as t,aU as r,$ as n,aI as c,aO as f,aG as h,aR as I,aS as N}from"./vendor.B9elh-7E.js";import{a8 as F}from"./common.CkQ_lQJm.js";const S={class:"min-h-screen bg-page-secondary py-8"},M={class:"mx-auto max-w-4xl px-4"},B={class:"mb-8 text-center"},U={class:"mb-2 text-3xl font-bold text-primary"},E={class:"text-primary"},V={class:"flex flex-wrap gap-2"},J=["onClick"],R={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},W={class:"grid grid-cols-1 gap-4 md:grid-cols-2"},z={class:"space-y-2"},A={class:"flex justify-between border-b pb-1"},G={class:"flex justify-between border-b pb-1"},K={class:"flex justify-between border-b pb-1"},P={class:"flex justify-between border-b pb-1"},Y={class:"flex justify-between border-b pb-1"},q={class:"space-y-2"},H={class:"flex justify-between border-b pb-1"},Q={class:"flex justify-between border-b pb-1"},X={class:"flex justify-between border-b pb-1"},Z={class:"flex justify-between border-b pb-1"},O={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},ss={class:"grid grid-cols-1 gap-4 md:grid-cols-2"},es={class:"space-y-1"},ts={class:"space-y-1"},os={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},ns={class:"space-y-3"},ls={class:"rounded bg-blue-50 p-3"},rs={class:"rounded bg-green-50 p-3"},as={class:"rounded bg-yellow-50 p-3"},ds={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},is={class:"space-y-3"},us={class:"flex items-center space-x-4"},ms={class:"rounded bg-surface-footer p-3"},bs={key:0,class:"text-green-600"},ps={key:1,class:"text-red-600"},gs={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},cs={class:"space-y-2"},fs={class:"text-sm text-primary"},vs={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},ys={class:"grid grid-cols-1 gap-4 md:grid-cols-2"},xs={class:"space-y-3"},hs={class:"rounded bg-page-secondary p-3"},$s={class:"rounded bg-page-secondary p-3"},ws={class:"space-y-3"},_s={class:"rounded bg-page-secondary p-3"},Cs={class:"rounded bg-page-secondary p-3"},ks={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},Ts={class:"space-y-4"},js={class:"flex flex-wrap gap-2"},Ds=["onClick"],Ls={class:"rounded bg-yellow-50 p-3"},Is={class:"mb-8 rounded-lg bg-surface-header p-6 shadow"},Ns={class:"space-y-4"},Fs={class:"rounded border p-4"},Ss={class:"space-y-3"},Ms={class:"block text-sm font-medium text-primary"},Bs=["placeholder"],Us={class:"flex space-x-2"},Es={type:"button",class:"rounded bg-green-500 px-4 py-2 text-absolute-light hover:bg-green-600"},Vs={type:"button",class:"rounded bg-info-type2 px-4 py-2 text-absolute-light hover:bg-container-type2-default"},Js={class:"rounded border p-4"},Rs={class:"flex space-x-4"},Ws={href:"#",class:"text-blue-600 hover:text-blue-800"},zs={href:"#",class:"text-blue-600 hover:text-blue-800"},As={href:"#",class:"text-blue-600 hover:text-blue-800"},Gs={href:"#",class:"text-blue-600 hover:text-blue-800"},Ks={class:"rounded border p-4"},Ps={class:"space-y-2"},Ys={class:"rounded bg-blue-100 p-2 text-blue-800"},qs={class:"rounded bg-red-100 p-2 text-red-800"},Hs={class:"rounded bg-green-100 p-2 text-green-800"},Qs={class:"rounded-lg bg-surface-secondary p-6 text-absolute-light"},Xs={class:"text-center"},Zs={class:"mb-2"},Os={class:"text-sm text-inverse-secondary"},oe=j({__name:"index",setup(se){const{t:$,locale:a,locales:b,setLocale:v}=D(),u=g({name:"John",email:"[email protected]",score:42,lastLogin:new Date}),w=g([{id:1,name:"Item One",count:1},{id:2,name:"Item Two",count:5},{id:3,name:"Item Three",count:0}]),y=g(new Date);L(()=>{F(()=>{y.value=new Date},1e3)});const _=m(()=>$("welcome")),p=m(()=>b.value.find(o=>o.code===a.value)),x=m(()=>new Intl.DateTimeFormat(a.value).format(y.value)),C=m(()=>new Intl.NumberFormat(a.value).format(123456789e-2)),k=m(()=>new Intl.NumberFormat(a.value,{style:"currency",currency:"USD"}).format(999.99));return(o,e)=>(d(),i("div",S,[s("div",M,[s("div",B,[s("h1",U,t(o.$tr("welcome"))+" - i18n Demo Page",1),s("p",E,[e[3]||(e[3]=r(" Current Language: ")),s("strong",null,t(n(p)?.name),1),r(" ("+t(n(a))+") ",1)]),s("div",V,[(d(!0),i(c,null,f(n(b),l=>(d(),i("button",{key:l.code,class:h(["rounded px-4 py-2 text-sm transition-colors",n(a)===l.code?"bg-blue-500 text-absolute-light":"bg-type1 text-primary hover:bg-surface-primary"]),onClick:T=>n(v)(l.code)},t(l.name),11,J))),128))])]),s("section",R,[e[13]||(e[13]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"},"1. Basic Translations",-1)),s("div",W,[s("div",z,[s("div",A,[e[4]||(e[4]=s("span",{class:"font-medium"}
1,"Welcome:",-1)),s("span",null,t(o.$tr("welcome")),1)]),s("div",G,[e[5]||(e[5]=s("span",{class:"font-medium"},"with params:",-1)),s("span",null,t(o.$tr("welcome-to-sporty",{name:n(u).name})),1)]),s("div",K,[e[6]||(e[6]=s("span",{class:"font-medium"},"Loading:",-1)),s("span",null,t(o.$tr("loading")),1)]),s("div",P,[e[7]||(e[7]=s("span",{class:"font-medium"},"Error:",-1)),s("span",null,t(o.$tr("error")),1)]),s("div",Y,[e[8]||(e[8]=s("span",{class:"font-medium"},"Save:",-1)),s("span",null,t(o.$tr("save")),1)])]),s("div",q,[s("div",H,[e[9]||(e[9]=s("span",{class:"font-medium"},"Cancel:",-1)),s("span",null,t(o.$tr("cancel")),1)]),s("div",Q,[e[10]||(e[10]=s("span",{class:"font-medium"},"Back:",-1)),s("span",null,t(o.$tr("back")),1)]),s("div",X,[e[11]||(e[11]=s("span",{class:"font-medium"},"Next:",-1)),s("span",null,t(o.$tr("next")),1)]),s("div",Z,[e[12]||(e[12]=s("span",{class:"font-medium"},"Language:",-1)),s("span",null,t(o.$tr("language")),1)])])])]),s("section",O,[e[16]||(e[16]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"},"2. Nested Object Translations",-1)),s("div",ss,[s("div",null,[e[14]||(e[14]=s("h3",{class:"mb-2 font-medium text-primary"},"Navigation:",-1)),s("ul",es,[s("li",null,"⢠"+t(o.$tr("navigation.home")),1),s("li",null,"⢠"+t(o.$tr("navigation.dashboard")),1),s("li",null,"⢠"+t(o.$tr("navigation.settings")),1),s("li",null,"⢠"+t(o.$tr("navigation.about")),1)])]),s("div",null,[e[15]||(e[15]=s("h3",{class:"mb-2 font-medium text-primary"},"Common:",-1)),s("ul",ts,[s("li",null,"⢠"+t(o.$tr("common.yes")),1),s("li",null,"⢠"+t(o.$tr("common.no")),1),s("li",null,"⢠"+t(o.$tr("common.submit")),1),s("li",null,"⢠"+t(o.$tr("common.reset")),1)])])])]),s("section",os,[e[20]||(e[20]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"}," 3. Reactive Translations with Computed ",-1)),s("div",ns,[s("div",ls,[e[17]||(e[17]=s("strong",null,"Using computed():",-1)),r(" "+t(n(_)),1)]),s("div",rs,[e[18]||(e[18]=s("strong",null,"Direct $tr():",-1)),r(" "+t(o.$tr("welcome")),1)]),s("div",as,[e[19]||(e[19]=s("strong",null,"Template expression:",-1)),r(" "+t(o.$tr("loading"))+"... ",1)])])]),s("section",ds,[e[22]||(e[22]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"},"4. Conditional Translations",-1)),s("div",is,[s("div",us,[s("button",{class:"rounded bg-blue-500 px-4 py-2 text-absolute-light hover:bg-blue-600",onClick:e[0]||(e[0]=l=>n(u).score++)},t(o.$tr("common.submit")),1),s("button",{class:"rounded bg-info-type2 px-4 py-2 text-absolute-light hover:bg-container-type2-default",onClick:e[1]||(e[1]=l=>n(u).score=0)},t(o.$tr("common.reset")),1)]),s("div",ms,[s("p",null,[e[21]||(e[21]=s("strong",null,"Score:",-1)),r(" "+t(n(u).score),1)]),n(u).score>0?(d(),i("p",bs,t(o.$tr("common.yes"))+" - You have points! ",1)):(d(),i("p",ps,t(o.$tr("common.no"))+" - No points yet.",1))])])]),s("section",gs,[e[23]||(e[23]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"},"5. Loops with Translations",-1)),s("div",cs,[(d(!0),i(c,null,f(n(w),l=>(d(),i("div",{key:l.id,class:"flex justify-between rounded border p-2"},[s("span",null,t(l.name),1),s("span",fs," Count: "+t(l.count)+" - "+t(l.count>0?o.$tr("common.yes"):o.$tr("common.no")),1)]))),128))])]),s("section",vs,[e[32]||(e[32]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"},"6. Locale-specific Formatting",-1)),s("div",ys,[s("div",xs,[s("div",hs,[e[24]||(e[24]=s("strong",null,"Current Time:",-1)),e[25]||(e[25]=s("br",null,null,-1)),r(" "+t(n(x)),1)]),s("div",$s,[e[26]||(e[26]=s("strong",null,"Number Format:",-1)),e[27]||(e[27]=s("br",null,null,-1)),r(" "+t(n(C)),1)])]),s("div",ws,[s("div",_s,[e[28]||(e[28]=s("strong",null,"Currency Format:",-1)),e[29]||(e[29]=s("br",null,null,-1)),r(" "+t(n(k)),1)]),s("div",Cs,[e[30]||(e[30]=s("strong",null,"User Last Login:",-1)),e[31]||(e[31]=s("br",null,null,-1)),r(" "+t(new Intl.DateTimeFormat(n(a),{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(n(u).lastLogin)),1)])])])]),s("section",ks,[e[36]||(e[36]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"},"7. Language Switching",-1)),s("div",Ts,[e[35]||(e[35]=s("p",{class:"text-primary"}," Click the language buttons to see translations change in real-time: ",-1)),s("div",js,[(d(!0),i(c,null,f(n(b),l=>(d(),i("button",{key:l.code,class:h(["rounded px-4 py-2 text-sm transition-colors",n(a)===l.code?"bg-blue-500 text-absolute-light":"bg-type1 text-primary hover:bg-surface-primary"]),onClick:T=>n(v)(l.code)},t(l.name),11,Ds))),128))]),s("div",Ls,[s("p",null,[e[33]||(e[33]=s("strong",null,"Current selection:",-1)),r(" "+t
1(n(p)?.name)+" ("+t(n(a))+") ",1)]),s("p",null,[e[34]||(e[34]=s("strong",null,"Welcome message:",-1)),r(" "+t(o.$tr("welcome")),1)])])])]),s("section",Is,[e[40]||(e[40]=s("h2",{class:"mb-4 text-xl font-semibold text-primary"},"8. Advanced Examples",-1)),s("div",Ns,[s("div",Fs,[e[37]||(e[37]=s("h3",{class:"mb-3 font-medium text-primary"},"Form with i18n",-1)),s("form",Ss,[s("div",null,[s("label",Ms,t(o.$tr("profile"))+":",1),I(s("input",{"onUpdate:modelValue":e[2]||(e[2]=l=>n(u).name=l),type:"text",class:"mt-1 block w-full rounded border border-type2 px-3 py-2",placeholder:o.$tr("profile")},null,8,Bs),[[N,n(u).name]])]),s("div",Us,[s("button",Es,t(o.$tr("save")),1),s("button",Vs,t(o.$tr("cancel")),1)])])]),s("div",Js,[e[38]||(e[38]=s("h3",{class:"mb-3 font-medium text-primary"},"Navigation Menu",-1)),s("nav",Rs,[s("a",Ws,t(o.$tr("navigation.home")),1),s("a",zs,t(o.$tr("navigation.dashboard")),1),s("a",As,t(o.$tr("navigation.settings")),1),s("a",Gs,t(o.$tr("navigation.about")),1)])]),s("div",Ks,[e[39]||(e[39]=s("h3",{class:"mb-3 font-medium text-primary"},"Status Messages",-1)),s("div",Ps,[s("div",Ys,"â¹ï¸ "+t(o.$tr("loading")),1),s("div",qs,"â "+t(o.$tr("error")),1),s("div",Hs," â
Data saved: "+t(o.$tr("save"))+" "+t(o.$tr("common.yes")),1)])])])]),s("footer",Qs,[s("div",Xs,[s("p",Zs,t(o.$tr("welcome"))+" to Sporty.com i18n Demo",1),s("p",Os,t(o.$tr("language"))+": "+t(n(p)?.name)+" | "+t(o.$tr("common.open"))+": "+t(n(x)),1)])])])]))}});export{oe as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.