Files
Librey/locale/localization.php
T
Delirious 82b5ae8dcd Fixed printftext having no return
There is a difference. 
Before, on index:
<a href='XX' target='_blank'></a>

After:
<a href='XX' target='_blank'>56</a>
2024-02-22 16:11:38 -07:00

29 lines
630 B
PHP

<?php
function printtext($key) {
echo TEXTS[$key];
}
function printftext() {
$argv = func_get_args();
$key = array_shift($argv);
return vprintf(TEXTS[$key], $argv);
}
// default to language "en"
$locale = "en";
if (array_key_exists("HTTP_ACCEPT_LANGUAGE", $_SERVER)) {
$accept_language_header = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
foreach(explode(",", explode(";", $accept_language_header)[0]) as $header_language) {
if (file_exists("locale/$header_language.php")) {
$locale = $header_language;
break;
}
}
}
define("TEXTS", require "locale/$locale.php");
?>