summaryrefslogtreecommitdiff
path: root/includes/system/history.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/system/history.inc')
-rw-r--r--includes/system/history.inc46
1 files changed, 40 insertions, 6 deletions
diff --git a/includes/system/history.inc b/includes/system/history.inc
index 31a7c73..b66b8c4 100644
--- a/includes/system/history.inc
+++ b/includes/system/history.inc
@@ -1,4 +1,4 @@
-<?php global $system; global $systemCommonName; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:history"]["name"] . " · " . $systemCommonName; global $systemID; $title = "Front history · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
+<?php global $system; global $lang; global $pages; global $systemCommonName; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:history"]["name"][$lang["_name"]] . " · " . $systemCommonName; global $systemID; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
function getMember(string $id) {
global $systemID;
@@ -28,6 +28,40 @@ function getMember(string $id) {
}
});
+ function frenchIfRequired($original) {
+ global $lang;
+
+ if ($lang["_french"]) {
+ if ($original === "Today") return "Aujourd'hui";
+ if ($original === "Yesterday") return "Hier";
+
+ $original = str_replace("Jan", "janv.", $original);
+ $original = str_replace("Feb", "fév.", $original);
+ $original = str_replace("Mar", "mars", $original);
+ $original = str_replace("Apr", "avr.", $original);
+ $original = str_replace("May", "mai", $original);
+ $original = str_replace("Jun", "juin", $original);
+ $original = str_replace("Jul", "juil.", $original);
+ $original = str_replace("Aug", "août", $original);
+ $original = str_replace("Sep", "sept.", $original);
+ $original = str_replace("Oct", "oct.", $original);
+ $original = str_replace("Nov", "nov.", $original);
+ $original = str_replace("Dec", "déc.", $original);
+
+ $original = str_replace("Mon", "Lun.", $original);
+ $original = str_replace("Tue", "Mar.", $original);
+ $original = str_replace("Wed", "Mer.", $original);
+ $original = str_replace("Thu", "Jeu.", $original);
+ $original = str_replace("Fri", "Ven.", $original);
+ $original = str_replace("Sat", "Sam.", $original);
+ $original = str_replace("Sun", "Dim.", $original);
+
+ return $original;
+ } else {
+ return $original;
+ }
+ }
+
function getSwitchesForDay(int $day) {
global $switches;
@@ -76,9 +110,9 @@ function getMember(string $id) {
}
?>
- <h2>Front history in the <?= $systemCommonName ?></h2>
+ <h2><?= $lang["history"]["title"] ?> <?= $systemCommonName ?></h2>
<div class="alert alert-warning" id="timezone" style="display: none;">
- Times on this page are now shown using your local timezone (<span id="timezone-name">-</span>). Days start at <span id="day-start">-</span> (00:00 on UTC).
+ <?= str_replace("%1", '<span id="timezone-name">-</span>', str_replace("%2", '<span id="day-start">-</span>', $lang["history"]["timezone"])) ?>
<script>
document.getElementById("day-start").innerText = new Date(<?= strtotime(date('Y-m-d')) ?> * 1000).toTimeString().substring(0, 5);
document.getElementById("timezone-name").innerText = new Date().toTimeString().split("(")[1].split(")")[0];
@@ -99,7 +133,7 @@ function getMember(string $id) {
$switchesDay = getSwitchesForDay($day[1]);
$switchesDay[] = getSwitchBefore($switchesDay[count($switchesDay) - 1]["id"]);
?>
- <h4 style="margin-top:15px;"><?= $day[0] ?></h4>
+ <h4 style="margin-top:15px;"><?= frenchIfRequired($day[0]) ?></h4>
<?php foreach ($switchesDay as $switch): $switch["timestamp"] = strtotime($switch["timestamp"]); ?>
<?php if (isset($switch["members"][0])): $member = getMemberWithoutSystem($switch["members"][0]); ?>
<div class="fronter">
@@ -111,7 +145,7 @@ function getMember(string $id) {
<img src="<?= getAsset($systemID, $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
</a>
<?php if (count($switch["members"]) > 1): ?>
- (with
+ (<?= $lang["system"]["with"] ?>
<?php if (isset($switch["members"][1])): $member2 = getMember($switch["members"][1]); ?><a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?><?php if (isset($switch["members"][2])): $member2 = getMember($switch["members"][2]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?><?php if (isset($switch["members"][3])): $member2 = getMember($switch["members"][3]); ?>, <a class="member-link" href="/<?= $member2["name"] ?>"><img src="<?= getAsset($systemID, $member2["id"], "heads") ?>" style="width:24px;"> <?= $member2["display_name"] ?? $member2["name"] ?></a><?php endif; ?>)
<?php endif; ?>
</span>
@@ -122,7 +156,7 @@ function getMember(string $id) {
<?= isNotToday($switch["timestamp"], $day[1]) ? "00:00" : date('H:i', $switch["timestamp"]) ?>
</span>
<span class="fronter-profile" style="vertical-align: middle;">
- <span class="text-muted">Fallback pony</span>
+ <span class="text-muted"><?= $lang["history"]["fallback"] ?></span>
</span>
</div>
<?php endif; ?>