commit
c9898cf261
95 changed files with 5217 additions and 0 deletions
28
locale/localization.php
Normal file
28
locale/localization.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?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_once "locale/$locale.php");
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue