Add month translation option

This commit is contained in:
ruan 2016-09-09 20:04:03 +02:00
parent 24936479f9
commit f6b86b8c2a
2 changed files with 35 additions and 9 deletions

View File

@ -302,6 +302,12 @@ class Page {
function millis_to_date($millis) {
$ts = $millis / 1000;
$result = strftime($this->settings->date_format, $ts);
$translations = $this->settings->date_month_translations;
if ($translations !== null) {
foreach ($translations as $key => $val) {
$result = str_replace($key, $val, $result);
}
}
return $result;
}

View File

@ -71,6 +71,25 @@ final class Settings {
// Enable error pages.
$this->error_pages = true;
$this->date_month_translations = null;
/*
$this->date_month_translations = array(
"January" => "Month 1",
"February" => "Month 2",
"March" => "Month 3",
"April" => "Month 4",
"May" => "Month 5",
"June" => "Month 6",
"July" => "Month 7",
"August" => "Month 8",
"September" => "Month 9",
"October" => "Month 10",
"November" => "Month 11",
"December" => "Month 12",
);
*/
/*** End of configuration ***/
@ -81,15 +100,6 @@ final class Settings {
ini_set("display_errors", 1);
}
$this->table = array(
'bans' => "${table_prefix}bans",
'mutes' => "${table_prefix}mutes",
'warnings' => "${table_prefix}warnings",
'kicks' => "${table_prefix}kicks",
'history' => "${table_prefix}history",
'servers' => "${table_prefix}servers",
);
$this->active_query = "";
if ($driver === "pgsql") {
@ -101,6 +111,16 @@ final class Settings {
$this->active_query = "WHERE active=" . Settings::$TRUE;
}
// Internal table names, do not translate.
$this->table = array(
'bans' => "${table_prefix}bans",
'mutes' => "${table_prefix}mutes",
'warnings' => "${table_prefix}warnings",
'kicks' => "${table_prefix}kicks",
'history' => "${table_prefix}history",
'servers' => "${table_prefix}servers",
);
$this->driver = $driver;
if ($connect) {
if ($username === "" && $password === "") {