<?php

if ($_SERVER['HTTP_HOST'] === "fr.equestria.horse") {
    $default = "fr";
} else {
    $default = "en";
}

$lf = $_COOKIE['PEH2_LANGUAGE'] ?? $default;

if (str_contains("/", $lf)) $lf = "en";
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/i18n/" . $lf . ".json")) $lf = "en";

$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/i18n/" . $lf . ".json"), true);