aboutsummaryrefslogtreecommitdiff
path: root/localisation.php
blob: a1c7bacf1616c7c537979749f7b197b884970f57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php

// TODO: actually determine this from request header (/ user info?)
const LANGUAGE = 'en';

$langData = parse_ini_file(__DIR__ . '/locale/' . LANGUAGE . '.ini');

function L(string $key, mixed ...$values) {
    global $langData;
    if (!isset($langData[$key])) {
        error_log("warn: translation key $key does not exist");
        return $key;
    }
    return sprintf($langData[$key], ...$values);
}