feat(i18n): localize data-layer labels (lib/data + lib/services) — English base complete
All display labels in MARKETS/ENTITY_TYPES/FIELDS/ENRICHMENTS/FREQUENCIES/DELIVERY_FORMATS + SERVICES/FLOW_LABEL are now {en,sv} with stable IDs/values (pricing logic, EntityType/Frequency unions, config keys unchanged). Added entityLabel()/FREQUENCY_LABEL/FORMAT_LABEL. Updated all render sites (configurator, tjanster, beskriv, katalog/[id]) to resolve via useT(). Also fixed 2 pre-existing tsc nits (auth BufferSource cast, orders-store sql.json param type). tsc 0, build green. 0pt is now fully English-by-default with SV toggle.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
@@ -74,11 +74,11 @@ export default function DescribePage() {
|
||||
color: service === s.id ? "var(--background)" : "var(--foreground)",
|
||||
}}
|
||||
>
|
||||
{s.name}
|
||||
{t(s.name)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
{svc ? <p className="mt-3 text-sm text-muted-foreground">{svc.covers} <span className="text-muted-foreground/60">→ {svc.deliverable}</span></p> : null}
|
||||
{svc ? <p className="mt-3 text-sm text-muted-foreground">{t(svc.covers)} <span className="text-muted-foreground/60">→ {t(svc.deliverable)}</span></p> : null}
|
||||
</div>
|
||||
|
||||
<div className="mt-8">
|
||||
|
||||
+15
-12
@@ -14,6 +14,9 @@ import {
|
||||
ENRICHMENTS,
|
||||
FREQUENCIES,
|
||||
DELIVERY_FORMATS,
|
||||
FREQUENCY_LABEL,
|
||||
FORMAT_LABEL,
|
||||
entityLabel,
|
||||
computeEstimate,
|
||||
formatSEK,
|
||||
type EntityType,
|
||||
@@ -137,12 +140,12 @@ export default function ConfiguratorPage() {
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{SERVICES.map((s) => (
|
||||
<Chip key={s.id} active={service === s.id} onClick={() => setService(s.id)}>
|
||||
{s.name}
|
||||
{t(s.name)}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
{serviceById(service) ? (
|
||||
<p className="mt-3 text-xs text-muted-foreground">{serviceById(service)!.covers}</p>
|
||||
<p className="mt-3 text-xs text-muted-foreground">{t(serviceById(service)!.covers)}</p>
|
||||
) : null}
|
||||
</Block>
|
||||
|
||||
@@ -169,7 +172,7 @@ export default function ConfiguratorPage() {
|
||||
<div className="flex gap-2">
|
||||
{ENTITY_TYPES.map((e) => (
|
||||
<Chip key={e.id} active={type === e.id} onClick={() => setType(e.id)}>
|
||||
{e.id}
|
||||
{t(e.label)}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
@@ -203,13 +206,13 @@ export default function ConfiguratorPage() {
|
||||
onChange={() => toggle(fieldIds, f.id, setFieldIds)}
|
||||
/>
|
||||
<span className="flex-1">
|
||||
<span className="text-sm">{f.name}</span>
|
||||
<span className="ml-2 text-xs text-muted-foreground">{f.sub}</span>
|
||||
<span className="text-sm">{t(f.name)}</span>
|
||||
<span className="ml-2 text-xs text-muted-foreground">{t(f.sub)}</span>
|
||||
{f.locked ? (
|
||||
<span className="ml-2 font-mono text-[10px] uppercase text-muted-foreground">{t({ en: "locked", sv: "låst" })}</span>
|
||||
) : null}
|
||||
</span>
|
||||
<ProvenanceBadge level={f.level as ProvLevel} source={f.source} freshness={f.freshness} />
|
||||
<ProvenanceBadge level={f.level as ProvLevel} source={t(f.source)} freshness={t(f.freshness)} />
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
@@ -224,7 +227,7 @@ export default function ConfiguratorPage() {
|
||||
active={enrichmentIds.includes(e.id)}
|
||||
onClick={() => toggle(enrichmentIds, e.id, setEnrichmentIds)}
|
||||
>
|
||||
{e.label}
|
||||
{t(e.label)}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
@@ -243,7 +246,7 @@ export default function ConfiguratorPage() {
|
||||
<div className="mt-3 flex gap-2">
|
||||
{FREQUENCIES.map((fr) => (
|
||||
<Chip key={fr} active={frequency === fr} onClick={() => setFrequency(fr)}>
|
||||
{fr}
|
||||
{t(FREQUENCY_LABEL[fr])}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
@@ -280,7 +283,7 @@ export default function ConfiguratorPage() {
|
||||
<div className="flex flex-wrap gap-2">
|
||||
{DELIVERY_FORMATS.map((f) => (
|
||||
<Chip key={f} active={formats.includes(f)} onClick={() => toggle(formats, f, setFormats)}>
|
||||
{f}
|
||||
{t(FORMAT_LABEL[f] ?? { en: f, sv: f })}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
@@ -297,13 +300,13 @@ export default function ConfiguratorPage() {
|
||||
</div>
|
||||
<dl className="divide-y divide-border">
|
||||
{[
|
||||
[t({ en: "Service", sv: "Tjänst" }), serviceById(service)?.name ?? service],
|
||||
[t({ en: "Service", sv: "Tjänst" }), serviceById(service) ? t(serviceById(service)!.name) : service],
|
||||
[t({ en: "Markets", sv: "Marknader" }), markets.join(" · ") || "—"],
|
||||
[t({ en: "Type", sv: "Typ" }), type],
|
||||
[t({ en: "Type", sv: "Typ" }), t(entityLabel(type))],
|
||||
[t({ en: "Fields", sv: "Fält" }), String(FIELDS.filter((f) => f.locked || fieldIds.includes(f.id)).length)],
|
||||
[t({ en: "Enrichment", sv: "Berikning" }), String(enrichmentIds.length)],
|
||||
[t({ en: "Volume", sv: "Volym" }), new Intl.NumberFormat("sv-SE").format(volume)],
|
||||
[t({ en: "Frequency", sv: "Frekvens" }), frequency],
|
||||
[t({ en: "Frequency", sv: "Frekvens" }), t(FREQUENCY_LABEL[frequency])],
|
||||
[t({ en: "Delivery", sv: "Leverans" }), `≈ ${est.timelineDays} ${t({ en: "days", sv: "dgr" })}`],
|
||||
[t({ en: "Confidence", sv: "Konfidens" }), `${est.estConfidence}%`],
|
||||
].map(([k, v]) => (
|
||||
|
||||
@@ -511,10 +511,11 @@ function QualityTab({ d }: { d: Dataset }) {
|
||||
}
|
||||
|
||||
function SchemaTab() {
|
||||
const t = useT();
|
||||
return (
|
||||
<div>
|
||||
<SectionHead num="04" kicker="Schema" />
|
||||
<p className="mt-8 font-mono text-[12px] text-muted-foreground">Fält, källa, vikt. Per fält.</p>
|
||||
<p className="mt-8 font-mono text-[12px] text-muted-foreground">{t({ en: "Field, source, weight. Per field.", sv: "Fält, källa, vikt. Per fält." })}</p>
|
||||
|
||||
<div className="mt-8">
|
||||
<DataArtifact variant="schema" />
|
||||
@@ -531,14 +532,14 @@ function SchemaTab() {
|
||||
<span className="font-mono text-[10px] tabular-nums text-muted-foreground">
|
||||
{String(i + 1).padStart(2, "0")}
|
||||
</span>
|
||||
<span className="text-[15px] tracking-tight">{f.name}</span>
|
||||
<span className="text-[15px] tracking-tight">{t(f.name)}</span>
|
||||
{f.locked ? (
|
||||
<span className="font-mono text-[9px] uppercase tracking-[0.12em] text-muted-foreground">låst</span>
|
||||
<span className="font-mono text-[9px] uppercase tracking-[0.12em] text-muted-foreground">{t({ en: "locked", sv: "låst" })}</span>
|
||||
) : null}
|
||||
</div>
|
||||
<p className="mt-1 pl-7 font-mono text-[11px] text-muted-foreground">{f.sub}</p>
|
||||
<p className="mt-1 pl-7 font-mono text-[11px] text-muted-foreground">{t(f.sub)}</p>
|
||||
</div>
|
||||
<ProvenanceBadge level={f.level} source={f.source} freshness={f.freshness} />
|
||||
<ProvenanceBadge level={f.level} source={t(f.source)} freshness={t(f.freshness)} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,7 @@ export default function ServicesPage() {
|
||||
return (
|
||||
<section key={flow} className="mt-16">
|
||||
<div className="flex items-baseline justify-between border-b border-border pb-4">
|
||||
<h2 className="font-mono text-[11px] uppercase tracking-[0.16em] text-muted-foreground">{FLOW_LABEL[flow]}</h2>
|
||||
<h2 className="font-mono text-[11px] uppercase tracking-[0.16em] text-muted-foreground">{t(FLOW_LABEL[flow])}</h2>
|
||||
<span className="font-mono text-[11px] tabular-nums text-muted-foreground/60">{String(items.length).padStart(2, "0")}</span>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 gap-px border border-border bg-border md:grid-cols-2 lg:grid-cols-3">
|
||||
@@ -47,10 +47,10 @@ export default function ServicesPage() {
|
||||
const cta = ctaFor(flow, s.id);
|
||||
return (
|
||||
<div key={s.id} className={`reveal delay-${(i % 6) + 1} group flex flex-col bg-background p-6 transition-colors hover:bg-secondary/40`}>
|
||||
<h3 className="text-lg font-semibold tracking-[-0.01em]">{s.name}</h3>
|
||||
<p className="mt-1 font-mono text-[11px] uppercase tracking-[0.06em] text-muted-foreground">{s.tagline}</p>
|
||||
<p className="mt-4 flex-1 text-sm text-muted-foreground">{s.covers}</p>
|
||||
<p className="mt-4 font-mono text-[10.5px] uppercase tracking-[0.08em] text-muted-foreground/70">→ {s.deliverable}</p>
|
||||
<h3 className="text-lg font-semibold tracking-[-0.01em]">{t(s.name)}</h3>
|
||||
<p className="mt-1 font-mono text-[11px] uppercase tracking-[0.06em] text-muted-foreground">{t(s.tagline)}</p>
|
||||
<p className="mt-4 flex-1 text-sm text-muted-foreground">{t(s.covers)}</p>
|
||||
<p className="mt-4 font-mono text-[10.5px] uppercase tracking-[0.08em] text-muted-foreground/70">→ {t(s.deliverable)}</p>
|
||||
<Link href={cta.href} className="mt-5 inline-flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.1em] underline-offset-4 hover:underline">
|
||||
{t(cta.label)}
|
||||
<span aria-hidden className="transition-transform duration-300 group-hover:translate-x-1">→</span>
|
||||
|
||||
Reference in New Issue
Block a user