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
TypeScript 3darchitecturebill-of-materialscadconstructionelectrical-designfloor-planfloorplan-editorhome-designhouse-plannerkonvamaplibrephpplumbingreactreact-three-fiberself-hostedthreejstypescriptunderfloor-heating
Default UI language to English: explicit choice only, localized title, meta and plot data
egmalt5c91280da6c5
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 42d76f3..44ba347 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,7 +8,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),### Changed-- The UI defaults to English; the browser language is no longer used. Russian is picked only explicitly via "⋯" → Language or `?lang=ru`. PHP messages follow the `lang` cookie, otherwise English.+- The UI defaults to English; the browser and system languages are no longer used. Russian is picked only explicitly via "⋯" → Language or `?lang=ru`; the choice is stored under `house-lang` (localStorage and cookie), old auto-cached `lang` / `i18nextLng` values are discarded. PHP messages follow the `house-lang` cookie, otherwise English.+- The tab title follows the language and the section ("House Planner — Plan"); `index.html` ships English description, Open Graph and Twitter card tags with `og.png`, and they are switched to the chosen language at runtime.+- "Plot & house" data can be localized: `public/data/house.<lang>.json` is loaded when present, with `house.json` as the fallback; a Russian `house.ru.json` for the demo is included.## [0.1.0] - 2026-10-01diff --git a/index.html b/index.htmlindex e09b20a..6bfea40 100644--- a/index.html+++ b/index.html@@ -5,6 +5,20 @@<link rel="icon" type="image/svg+xml" href="./favicon.svg" /><meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" /><title>House Planner</title>+ <meta name="description" content="Self-hosted house planner: true-scale 2D floor plan, 3D preview, satellite map, utility networks and a priced bill of materials." />+ <meta name="theme-color" content="#f3f1ec" />+ <meta property="og:type" content="website" />+ <meta property="og:site_name" content="House Planner" />+ <meta property="og:title" content="House Planner" />+ <meta property="og:description" content="Self-hosted house planner: true-scale 2D floor plan, 3D preview, satellite map, utility networks and a priced bill of materials." />+ <meta property="og:image" content="https://app.homedesignsai.pro/og.png" />+ <meta property="og:image:width" content="1600" />+ <meta property="og:image:height" content="1000" />+ <meta property="og:locale" content="en_US" />+ <meta name="twitter:card" content="summary_large_image" />+ <meta name="twitter:title" content="House Planner" />+ <meta name="twitter:description" content="Self-hosted house planner: true-scale 2D floor plan, 3D preview, satellite map, utility networks and a priced bill of materials." />+ <meta name="twitter:image" content="https://app.homedesignsai.pro/og.png" /></head><body><div id="root"></div>diff --git a/public/api/_i18n.php b/public/api/_i18n.phpindex 0e0de19..29fa8bb 100644--- a/public/api/_i18n.php+++ b/public/api/_i18n.php@@ -6,7 +6,7 @@ function ui_lang(): stringif ($lang !== null) {return $lang;}- $cookie = $_COOKIE['lang'] ?? '';+ $cookie = $_COOKIE['house-lang'] ?? '';if ($cookie === 'en' || $cookie === 'ru') {return $lang = $cookie;}diff --git a/public/data/house.ru.json b/public/data/house.ru.jsonnew file mode 100644index 0000000..aa23996--- /dev/null+++ b/public/data/house.ru.json@@ -0,0 +1,361 @@+{+ "title": "Участок и дом",+ "subtitle": "Демо-участок 30 × 45 м · участок 12, Демо-переулок · вымышленные данные",+ "updated": "2026-10-01",+ "sections": [+ {+ "id": "parcel",+ "title": "Участок",+ "lead": "Пример паспорта участка. Замените его своими данными в public/data/house.json (русская версия — public/data/house.ru.json).",+ "blocks": [+ {+ "type": "facts",+ "title": "Основное",+ "items": [+ {+ "label": "Адрес",+ "value": "Демо-переулок, 12",+ "hint": "Вымышленный адрес"+ },+ {+ "label": "Участок",+ "value": "Участок 12 в новом посёлке",+ "hint": "Соседи: участки 11 и 13"+ },+ {+ "label": "Площадь",+ "value": "1350 м²",+ "hint": "30 × 45 м, прямоугольный"+ },+ {+ "label": "Назначение",+ "value": "Жилая застройка, один отдельный дом"+ },+ {+ "label": "Рельеф",+ "value": "Ровное бывшее поле, без деревьев и построек"+ },+ {+ "label": "Подъезд",+ "value": "С Демо-переулка вдоль стороны 30 м",+ "hint": "Гравийная дорога с северо-востока"+ },+ {+ "label": "Коммуникации",+ "value": "Электричество у дороги; вода из своей скважины; канализация в локальные очистные"+ },+ {+ "label": "Расположение",+ "value": "Сельская местность у Кийли, уезд Харьюмаа, Эстония",+ "hint": "Нужно только, чтобы показать демо на спутниковом снимке"+ }+ ]+ },+ {+ "type": "map",+ "title": "Схема участка",+ "caption": "Вид сверху в осях плана, улица внизу. Пятно застройки: 3 м от соседей и задней границы, 5 м от улицы.",+ "north": 152,+ "parcel": {+ "label": "Участок 12",+ "note": "30 × 45 м",+ "points": [+ [+ 0,+ 0+ ],+ [+ 30,+ 0+ ],+ [+ 30,+ 45+ ],+ [+ 0,+ 45+ ]+ ]+ },+ "sides": [+ {+ "at": [+ 15,+ 0+ ],+ "len": 30,+ "angle": 0+ },+ {+ "at": [+ 30,+ 22.5+ ],+ "len": 45,+ "angle": 90+ },+ {+ "at": [+ 15,+ 45+ ],+ "len": 30,+ "angle": 0+ },+ {+ "at": [+ 0,+ 22.5+ ],+ "len": 45,+ "angle": 90+ }+ ],+ "neighbors": [+ {+ "label": "Участок 11",+ "note": "свободен",+ "points": [+ [+ -30,+ 0+ ],+ [+ 0,+ 0+ ],+ [+ 0,+ 45+ ],+ [+ -30,+ 45+ ]+ ]+ },+ {+ "label": "Участок 13",+ "note": "свободен",+ "points": [+ [+ 30,+ 0+ ],+ [+ 60,+ 0+ ],+ [+ 60,+ 45+ ],+ [+ 30,+ 45+ ]+ ]+ }+ ],+ "zone": {+ "label": "Пятно застройки ≈ 888 м²",+ "points": [+ [+ 3,+ 3+ ],+ [+ 27,+ 3+ ],+ [+ 27,+ 40+ ],+ [+ 3,+ 40+ ]+ ]+ },+ "street": {+ "label": "Демо-переулок",+ "at": [+ 15,+ 50.5+ ],+ "angle": 0,+ "band": [+ [+ -20,+ 47.5+ ],+ [+ 50,+ 47.5+ ],+ [+ 50,+ 50.5+ ],+ [+ -20,+ 50.5+ ]+ ]+ }+ },+ {+ "type": "links",+ "title": "Ссылки",+ "items": [+ {+ "title": "Esri World Imagery",+ "url": "https://www.arcgis.com/home/item.html?id=10df2279f9684e4a9f6a7f08febac2a9",+ "note": "Спутниковая подложка вкладки «Карта»"+ }+ ]+ }+ ]+ },+ {+ "id": "norms",+ "title": "Отступы и нормы",+ "lead": "Примерные значения, по которым проверяет планировщик. Местные правила застройки и строительные нормы всегда главнее.",+ "blocks": [+ {+ "type": "note",+ "tone": "info",+ "text": "**Сначала сверьтесь с местной документацией по планировке.** Отступы, предельную площадь застройки и высоту задаёт муниципалитет для каждого посёлка; цифры ниже — типовые значения, а не юридическая консультация."+ },+ {+ "type": "facts",+ "title": "Расстояния на участке",+ "items": [+ {+ "label": "Дом — граница с соседом",+ "value": "3 м"+ },+ {+ "label": "Дом — граница с улицей",+ "value": "5 м"+ },+ {+ "label": "Гараж, сарай — граница",+ "value": "1 м"+ },+ {+ "label": "Между зданиями (противопожарный разрыв)",+ "value": "6 м",+ "hint": "Меньше — при огнестойких стенах"+ },+ {+ "label": "Очистные — дом / граница",+ "value": "5 м / 1 м"+ },+ {+ "label": "Скважина — очистные",+ "value": "50 м",+ "hint": "В паспортах станций обычно минимум 15 м"+ },+ {+ "label": "Глубина водопровода",+ "value": "≥ 1,5 м",+ "hint": "Ниже глубины промерзания или с греющим кабелем"+ },+ {+ "label": "Глубина наружной канализации",+ "value": "≥ 1,0 м",+ "hint": "Мельче — с утеплением"+ }+ ]+ },+ {+ "type": "table",+ "title": "Помещения и освещённость",+ "source": "Проверка планировщика: площадь окон ≥ 1/8 площади пола в гостиной и спальнях",+ "columns": [+ "Помещение",+ "Пол, м²",+ "Окна, м²",+ "Соотношение"+ ],+ "rows": [+ [+ "Гостиная / кухня",+ "38,8",+ "7,6",+ "1 : 5,1"+ ],+ [+ "Главная спальня",+ "15,4",+ "2,7",+ "1 : 5,7"+ ],+ [+ "Спальня 2",+ "11,1",+ "3,5",+ "1 : 3,2"+ ],+ [+ "Спальня 3",+ "10,3",+ "2,1",+ "1 : 4,9"+ ]+ ]+ }+ ]+ },+ {+ "id": "docs",+ "title": "Документы",+ "lead": "Типовые документы для нового дома; статусы — для примера.",+ "blocks": [+ {+ "type": "list",+ "items": [+ {+ "title": "Выписка из реестра",+ "status": "есть",+ "note": "Собственник, площадь и разрешённое использование"+ },+ {+ "title": "Планировка / условия проектирования",+ "status": "есть",+ "note": "Отступы, пятно застройки, высота, форма кровли"+ },+ {+ "title": "Топосъёмка",+ "status": "в работе",+ "note": "Основа для генплана и отметок"+ },+ {+ "title": "Договор на техприсоединение",+ "status": "нужно",+ "note": "Номинал вводного автомата, учёт на границе участка"+ },+ {+ "title": "Согласование скважины и очистных",+ "status": "нужно",+ "note": "Места — как на плане"+ },+ {+ "title": "Разрешение на строительство",+ "status": "позже",+ "note": "Подаётся с основным проектом"+ },+ {+ "title": "Разрешение на ввод в эксплуатацию",+ "status": "позже",+ "note": "После завершения и исполнительной документации"+ }+ ]+ }+ ]+ }+ ]+}diff --git a/public/og.png b/public/og.pngnew file mode 100644index 0000000..63a63f9Binary files /dev/null and b/public/og.png differdiff --git a/src/i18n/index.ts b/src/i18n/index.tsindex 8a0c516..60360db 100644--- a/src/i18n/index.ts+++ b/src/i18n/index.ts@@ -1,6 +1,7 @@import i18n from 'i18next'import LanguageDetector from 'i18next-browser-languagedetector'import { initReactI18next } from 'react-i18next'+import { sections } from '../ui/useSection'export const LANGUAGES = ['en', 'ru'] as constexport type Lang = (typeof LANGUAGES)[number]@@ -29,8 +30,19 @@ for (const [path, data] of Object.entries(files)) {byNs[ns] = merge(byNs[ns] ?? {}, data)}+const STORE_KEY = 'house-lang'+const CACHES = ['localStorage', 'cookie']++try {+ localStorage.removeItem('lang')+ localStorage.removeItem('i18nextLng')+} catch {}+for (const name of ['lang', 'i18nextLng']) document.cookie = `${name}=; max-age=0; path=/`++const detector = new LanguageDetector()+void i18n- .use(LanguageDetector)+ .use(detector).use(initReactI18next).init({resources,@@ -48,22 +60,46 @@ void i18ndetection: {order: ['querystring', 'localStorage', 'cookie'],lookupQuerystring: 'lang',- lookupLocalStorage: 'lang',- lookupCookie: 'lang',- caches: ['localStorage', 'cookie'],+ lookupLocalStorage: STORE_KEY,+ lookupCookie: STORE_KEY,+ caches: [],+ cookieMinutes: 60 * 24 * 365,},})-const syncDocument = (lng: string) => {+const remember = (lng: string) => detector.cacheUserLanguage(lng, CACHES)++const fromQuery = new URLSearchParams(window.location.search).get('lang')+if (fromQuery && (LANGUAGES as readonly string[]).includes(fromQuery)) remember(fromQuery)++const setMeta = (selector: string, content: string) => document.querySelector(selector)?.setAttribute('content', content)++const syncDocument = () => {+ const lng = i18n.resolvedLanguage === 'ru' ? 'ru' : 'en'+ const app = i18n.t('common:app.title')+ const id = window.location.hash.replace(/^#\/?/, '')+ const section = sections.find((s) => s.id === id) ?? sections[0]+ const title = `${app} — ${i18n.t(`common:${section.label}`)}`+ const description = i18n.t('common:app.description')document.documentElement.lang = lng- document.title = i18n.t('common:app.title')+ document.title = title+ setMeta('meta[name="description"]', description)+ setMeta('meta[property="og:title"]', title)+ setMeta('meta[property="og:description"]', description)+ setMeta('meta[property="og:locale"]', lng === 'ru' ? 'ru_RU' : 'en_US')+ setMeta('meta[name="twitter:title"]', title)+ setMeta('meta[name="twitter:description"]', description)}-syncDocument(i18n.resolvedLanguage ?? 'en')+syncDocument()i18n.on('languageChanged', syncDocument)+window.addEventListener('hashchange', syncDocument)export const lang = (): Lang => (i18n.resolvedLanguage === 'ru' ? 'ru' : 'en')export const locale = () => (lang() === 'ru' ? 'ru-RU' : 'en-US')-export const setLang = (lng: Lang) => i18n.changeLanguage(lng)+export const setLang = (lng: Lang) => {+ remember(lng)+ return i18n.changeLanguage(lng)+}const formats = new Map<string, Intl.NumberFormat>()export const numberFormat = (opts: Intl.NumberFormatOptions = {}) => {diff --git a/src/i18n/locales/en/common.json b/src/i18n/locales/en/common.jsonindex 72bcfb2..e6898bc 100644--- a/src/i18n/locales/en/common.json+++ b/src/i18n/locales/en/common.json@@ -1,6 +1,7 @@{"app": {- "title": "House Planner"+ "title": "House Planner",+ "description": "Self-hosted house planner: true-scale 2D floor plan, 3D preview, satellite map, utility networks and a priced bill of materials."},"units": {"mm": "mm",diff --git a/src/i18n/locales/ru/common.json b/src/i18n/locales/ru/common.jsonindex 36ebff1..60b31c8 100644--- a/src/i18n/locales/ru/common.json+++ b/src/i18n/locales/ru/common.json@@ -1,6 +1,7 @@{"app": {- "title": "Планировщик дома"+ "title": "Планировщик дома",+ "description": "Планировщик частного дома на своём хостинге: план в реальном масштабе, 3D, спутниковая карта, инженерные сети и смета с ценами."},"units": {"mm": "мм",diff --git a/src/info/InfoPage.tsx b/src/info/InfoPage.tsxindex e7ace89..cbbe8af 100644--- a/src/info/InfoPage.tsx+++ b/src/info/InfoPage.tsx@@ -6,7 +6,14 @@ import { fmtDate } from './util'import type { Block, HouseData } from './types'import './info.css'-const DATA_URL = `${import.meta.env.BASE_URL}data/house.json`+const dataUrl = (lng: string) => `${import.meta.env.BASE_URL}data/house${lng === 'en' ? '' : `.${lng}`}.json`++const loadData = async (lng: string): Promise<HouseData> => {+ let r = await fetch(dataUrl(lng), { cache: 'no-cache' })+ if (r.status === 404 && lng !== 'en') r = await fetch(dataUrl('en'), { cache: 'no-cache' })+ if (!r.ok) throw new Error(`HTTP ${r.status}`)+ return r.json() as Promise<HouseData>+}const pairs = (blocks: Block[]) =>blocks.map((b, i) => {@@ -16,24 +23,25 @@ const pairs = (blocks: Block[]) =>})export default function InfoPage() {- const { t } = useTranslation('info')+ const { t, i18n } = useTranslation('info')+ const lng = i18n.resolvedLanguage === 'ru' ? 'ru' : 'en'const [data, setData] = useState<HouseData | null>(null)const [error, setError] = useState<string | null>(null)const refs = useRef<Record<string, HTMLElement | null>>({})useEffect(() => {let alive = true- fetch(DATA_URL, { cache: 'no-cache' })- .then((r) => {- if (!r.ok) throw new Error(`HTTP ${r.status}`)- return r.json() as Promise<HouseData>+ loadData(lng)+ .then((d) => {+ if (!alive) return+ setData(d)+ setError(null)})- .then((d) => alive && setData(d)).catch((e: unknown) => alive && setError(t('loadError', { error: e instanceof Error ? e.message : String(e) })))return () => {alive = false}- }, [])+ }, [lng])if (error) return <div className="info"><div className="info-note info-note--warn">{error}</div></div>if (!data) return <div className="info"><div className="info-loading">{t('loading')}</div></div>diff --git a/src/info/README.md b/src/info/README.mdindex 0a08d83..b0a6935 100644--- a/src/info/README.md+++ b/src/info/README.md@@ -1,6 +1,6 @@# Раздел «Участок и дом»-Страница `#/info` строится целиком из `public/data/house.json`. Компонент `InfoPage.tsx` загружает файл при открытии и рисует секции по порядку; пересборка сайта нужна только при правке кода, для правки данных достаточно залить новый JSON.+Страница `#/info` строится целиком из `public/data/house.json`; для русского интерфейса берётся `public/data/house.ru.json`, а если его нет — тот же `house.json`. Компонент `InfoPage.tsx` загружает файл при открытии и рисует секции по порядку; пересборка сайта нужна только при правке кода, для правки данных достаточно залить новый JSON.## Формат house.json