Objectify locale negotiator and template files, add documentation

This commit is contained in:
Vojtěch Sajdl
2018-01-07 20:39:10 +01:00
parent 9820686776
commit 61f563c9b0
20 changed files with 440 additions and 230 deletions
+16 -2
View File
@@ -9,13 +9,27 @@ define("MAILER_ADDRESS", "##mailer_email##"); //Mailer address
define("INSTALL_OVERRIDE", false);
define("DEFAULT_LANGUAGE", "en_GB");
require("locale.php");
require("classes/locale-negotiator.php");
if (!isset($_SESSION['locale'])||isset($_GET['lang']))
{
$override = ((isset($_GET['lang']))?$_GET['lang']:null);
$negotiator = new LocaleNegotiator(DEFAULT_LANGUAGE);
$best_match = $negotiator->negotiate($override);
$_SESSION['locale'] = $best_match;
setlocale(LC_ALL, $_SESSION['locale'].".UTF-8");
bindtextdomain("server-status", __DIR__ . "/locale/");
bind_textdomain_codeset($_SESSION['locale'], "utf-8");
textdomain("server-status");
}
//Database connection
$mysqli = new mysqli("##server##","##user##","##password##","##database##");
if ($mysqli->connect_errno) {
printf("Connection failed: %s\n", $mysqli->connect_error);
printf(_("Connection failed: %s\n"), $mysqli->connect_error);
exit();
}