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

417 B
Raw Blame
<?php

function ui_lang(): string
{
    static $lang = null;
    if ($lang !== null) {
        return $lang;
    }
    $cookie = $_COOKIE['house-lang'] ?? '';
    if ($cookie === 'en' || $cookie === 'ru') {
        return $lang = $cookie;
    }
    return $lang = 'en';
}

function tr(string $en, string $ru, ...$args): string
{
    $s = ui_lang() === 'ru' ? $ru : $en;
    return $args ? vsprintf($s, $args) : $s;
}