- labelsUi.* (221+ keys): spot categories/features/types, access, shelter, event types, gear categories/conditions, price/listings, tours, crews, member-visibility, tag categories, spot status. New src/lib/labelKeys.ts holds the shared value->key maps (one source; the five duplicated EVENT_TYPE_KEYS copies now import it). spotStatus.statusTimeAgo() uses the locale date shim. - formatPrice() now takes an optional t so FREE/Trade/Make Offer translate. - Route helpers: skateTime/distanceReadout/maneuver descriptors/formatAge translated (routeUi.*), consumers updated. - Sasquatch: PRO_TIERS labels/badges + summarizeDraft titles/lines/ctas translated (sasquatchUi.*). - Lab *_LABELS/_DESCRIPTIONS maps remain English (documented out of scope).
16 lines
661 B
TypeScript
16 lines
661 B
TypeScript
import { SPOT_TYPE_LABELS } from '@/lib/types';
|
|
import { SPOT_TYPE_KEYS } from '@/lib/labelKeys';
|
|
|
|
type Translate = (key: string, params?: Record<string, string | number>) => string;
|
|
|
|
/**
|
|
* Localised label for a spot type/category key. Every key with a
|
|
* `labelsUi.spotType.*` translation is translated; anything else (legacy values)
|
|
* falls back to the English `SPOT_TYPE_LABELS` label, or the key itself as a
|
|
* last resort, so map popups never show a raw tag string.
|
|
*/
|
|
export function spotTypeLabel(t: Translate, key: string): string {
|
|
const labelKey = SPOT_TYPE_KEYS[key];
|
|
if (labelKey) return t(labelKey);
|
|
return SPOT_TYPE_LABELS[key] ?? key;
|
|
}
|