Skip to content

Self-hosted house planner: true-scale 2D floor plan, 3D, satellite map overlay, sewer, electrical, water and underfloor heating with calculations, priced bill of materials. React + PHP, no database. By the team behind homedesignsai.pro

557 B
Raw Blame
import { fmtNum, t } from '../i18n'

export function labelMap<K extends string>(keys: readonly K[], prefix: string): Record<K, string> {
  const map = {} as Record<K, string>
  for (const k of keys) Object.defineProperty(map, k, { get: () => t(`${prefix}.${k}`), enumerable: true })
  return map
}

export type ItemUnit = 'm' | 'pcs'

export { unitLabel } from '../i18n/units'

export const fmtPct = (v: number, d = 2) => t('networks:shared.units.pct', { v: fmtNum(v, d) })

export const fmtM = (mm: number) => `${fmtNum(mm / 1000)} ${t('common:units.m')}`