Files
kaiser-natron/dist/assets/BundleCard-BwM48yom.js
Dorian 0c9a0ccd95 bundles: locale-aware copy via i18n keys
Bundle data was carrying localized strings (name, usage, items,
description, imageAlt, badge) directly, so EN visitors saw German
copy on the bundle page and home grid. Strings are now keyed under
bundle.<id>.<field> in the i18n catalogue (DE + EN); src/api/bundles.js
keeps only structural data + i18n key references.

HomePage builds a localizedBundles computed that resolves the keys
through t() before passing to the Bundles design-system component,
so the existing component stays agnostic of i18n. BundlePage exposes
a `bundleCopy` computed for the same reason, and resolvedItems now
maps over `itemKeys` instead of static labels.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-04 11:02:46 +01:00

1 line
5.2 KiB
JavaScript

import{C as e,G as t,O as n,T as r,c as i,ft as a,j as o,l as s,m as c,o as l,p as u,r as d,s as f,u as p,ut as m}from"./runtime-core.esm-bundler-DTXUv7Wx.js";import{t as h}from"./vue-router-Cyqru1db.js";import{t as g}from"./Icon-BCo6-bGH.js";import{t as _}from"./i18n-XDSWEyNo.js";import{t as v}from"./Badge-DiccZCC_.js";import{t as y}from"./Button-D1Rp2Xe1.js";var b=[`src`,`alt`],x=[`src`,`alt`],S={class:`flex flex-col gap-1.5`},C={key:0,class:`text-xs font-semibold tracking-label text-muted uppercase`},w={class:`flex flex-col gap-1.5`},T={key:0,class:`text-sm text-muted tracking-label`},E={class:`flex flex-col gap-0.5`},D={class:`text-xs tracking-label text-muted uppercase`},O={class:`font-display text-2xl font-normal text-brand leading-none`},k={key:0,class:`text-xs text-muted mt-1`},A={key:1,class:`text-xs font-semibold tracking-label uppercase text-danger mt-1`},j=3,M={__name:`BundleCard`,props:{name:{type:String,required:!0},items:{type:Array,required:!0},price:{type:Number,required:!0},memberPrice:{type:Number,default:null},usage:{type:String,default:``},image:{type:String,required:!0},imageAlt:{type:String,default:``},badge:{type:String,default:``},badgeVariant:{type:String,default:`accent`,validator:e=>[`neutral`,`brand`,`accent`,`subtle`,`success`,`warning`,`danger`].includes(e)},tone:{type:String,default:`paper`,validator:e=>[`paper`,`cream`].includes(e)},layout:{type:String,default:`vertical`,validator:e=>[`vertical`,`horizontal`].includes(e)},inStock:{type:Boolean,default:!0},currency:{type:String,default:``},href:{type:String,default:``},imageFit:{type:String,default:`cover`,validator:e=>[`contain`,`cover`].includes(e)}},emits:[`add`],setup(M){function N(e){return typeof e==`string`&&e.startsWith(`/`)&&!e.startsWith(`//`)}let P=M,{t:F}=_(),I={paper:{surface:`bg-paper`,media:`bg-cream`,border:`border-line`},cream:{surface:`bg-cream`,media:`bg-paper`,border:`border-line`}},L=l(()=>I[P.tone]);function R(e){return`${P.currency} ${e.toFixed(2).replace(`.`,`,`)}`}let z=l(()=>R(P.price)),B=l(()=>P.memberPrice==null?``:R(P.memberPrice)),V=l(()=>P.items.slice(0,j)),H=l(()=>Math.max(0,P.items.length-j));return(l,_)=>(e(),p(`article`,{class:m([`group flex overflow-hidden rounded-md border transition-all duration-base ease-out`,M.layout===`horizontal`?`flex-col md:flex-row`:`flex-col`,L.value.surface,L.value.border,`hover:-translate-y-1 hover:shadow-md hover:border-brand-soft`])},[M.href&&N(M.href)?(e(),i(t(h),{key:0,to:M.href,class:m([`relative block overflow-hidden`,M.layout===`horizontal`?`aspect-[4/3] md:aspect-auto md:w-[38%] md:shrink-0 md:min-h-[300px]`:`aspect-[4/3]`,L.value.media])},{default:o(()=>[M.badge?(e(),i(v,{key:0,variant:M.badgeVariant,class:`absolute top-4 left-4 z-[1]`},{default:o(()=>[u(a(M.badge),1)]),_:1},8,[`variant`])):s(``,!0),f(`img`,{src:M.image,alt:M.imageAlt||M.name,loading:`lazy`,decoding:`async`,class:m([`absolute inset-0 w-full h-full transition-transform duration-slow ease-out group-hover:scale-105`,M.imageFit===`cover`?`object-cover`:`object-contain `+(M.layout===`horizontal`?`p-6 md:p-5`:`p-8`)])},null,10,b)]),_:1},8,[`to`,`class`])):(e(),i(n(M.href?`a`:`div`),{key:1,href:M.href||null,class:m([`relative block overflow-hidden`,M.layout===`horizontal`?`aspect-[4/3] md:aspect-auto md:w-[38%] md:shrink-0 md:min-h-[300px]`:`aspect-[4/3]`,L.value.media])},{default:o(()=>[M.badge?(e(),i(v,{key:0,variant:M.badgeVariant,class:`absolute top-4 left-4 z-[1]`},{default:o(()=>[u(a(M.badge),1)]),_:1},8,[`variant`])):s(``,!0),f(`img`,{src:M.image,alt:M.imageAlt||M.name,loading:`lazy`,decoding:`async`,class:m([`absolute inset-0 w-full h-full transition-transform duration-slow ease-out group-hover:scale-105`,M.imageFit===`cover`?`object-cover`:`object-contain `+(M.layout===`horizontal`?`p-6 md:p-5`:`p-8`)])},null,10,x)]),_:1},8,[`href`,`class`])),f(`div`,{class:m([`flex flex-col gap-4 p-6`,M.layout===`horizontal`?`md:p-6 md:flex-1`:``])},[f(`div`,S,[M.usage?(e(),p(`span`,C,a(M.usage),1)):s(``,!0),M.href&&N(M.href)?(e(),i(t(h),{key:1,to:M.href,class:`font-display text-xl font-normal leading-tight text-ink hover:text-brand transition-colors duration-base`},{default:o(()=>[u(a(M.name),1)]),_:1},8,[`to`])):(e(),i(n(M.href?`a`:`h3`),{key:2,href:M.href||null,class:m([`font-display text-xl font-normal leading-tight text-ink`,M.href?`hover:text-brand transition-colors duration-base`:``])},{default:o(()=>[u(a(M.name),1)]),_:1},8,[`href`,`class`]))]),f(`ul`,w,[(e(!0),p(d,null,r(V.value,t=>(e(),p(`li`,{key:t,class:`text-sm text-ink/80 leading-relaxed`},a(t),1))),128)),H.value>0?(e(),p(`li`,T,`+ `+a(H.value)+` `+a(t(F)(`bundles.card.moreItems`)),1)):s(``,!0)]),f(`div`,{class:m([`mt-auto pt-4 border-t border-line flex gap-3`,M.layout===`horizontal`?`flex-col sm:flex-row sm:items-end sm:justify-between`:`flex-col`])},[f(`div`,E,[f(`span`,D,a(t(F)(`bundles.card.priceLabel`)),1),f(`span`,O,a(z.value),1),B.value?(e(),p(`span`,k,a(t(F)(`bundles.card.memberPrefix`))+` `+a(B.value),1)):s(``,!0),M.inStock?s(``,!0):(e(),p(`span`,A,a(t(F)(`ds.product.outOfStock`)),1))]),c(y,{variant:`primary`,size:`md`,block:M.layout===`vertical`,disabled:!M.inStock,onClick:_[0]||=e=>l.$emit(`add`)},{before:o(()=>[c(g,{name:`plus`,size:16})]),default:o(()=>[u(` `+a(t(F)(`ds.buttons.addToCart`)),1)]),_:1},8,[`block`,`disabled`])],2)],2)],2))}};export{M as t};