i18n: render battle reports in each reader's language (EN/FR/RO) (#236)

This commit is contained in:
Ferywir
2026-06-17 15:24:37 +02:00
committed by GitHub
parent abe36748d7
commit 51c9cc5b2c
11 changed files with 309 additions and 86 deletions
+3 -3
View File
@@ -7,7 +7,7 @@
# - No structural changes affecting gameplay
#################################################################################
$dataarray = explode(",", $message->readingNotice['data']);
$dataarray = array_map('tz_expand_report', explode(",", $message->readingNotice['data']));
// ======================== BASIC SETTINGS ========================
$hasHero = (isset($dataarray[178]) && $dataarray[178] > 0);
@@ -80,7 +80,7 @@ if ($database->isVillageOases($dataarray[29])) {
<tr>
<?php $date = $generator->procMtime($message->readingNotice['time']); ?>
<td class="sent"><?php echo TZ_SENT; ?></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." at ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." ".TZ_AT." ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
</tr>
</thead>
@@ -113,7 +113,7 @@ for ($i = $start; $i <= ($start + 9); $i++) {
}
if ($hasHero) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"".RC_HERO."\" alt=\"".RC_HERO."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
+1 -1
View File
@@ -7,7 +7,7 @@
# - Improved readability + minor performance gain
#################################################################################
$dataarray = explode(",", $message->readingNotice['data']);
$dataarray = array_map('tz_expand_report', explode(",", $message->readingNotice['data']));
// ======================== URL SETUP ========================
+3 -3
View File
@@ -7,7 +7,7 @@
# - Minor safety fixes (undefined vars / repeated calls)
#################################################################################
$dataarray = explode(",", $message->readingNotice['data']);
$dataarray = array_map('tz_expand_report', explode(",", $message->readingNotice['data']));
// ======================== URL SETUP ========================
@@ -61,7 +61,7 @@ if ($fromName != "[?]") {
<tr>
<?php $date = $generator->procMtime($message->readingNotice['time']); ?>
<td class="sent"><?php echo TZ_SENT; ?></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." at ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." ".TZ_AT." ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
</tr>
</thead>
@@ -99,7 +99,7 @@ for ($i = $start; $i <= ($start + 9); $i++) {
// hero column
if ($hasHero) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"".RC_HERO."\" alt=\"".RC_HERO."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
+3 -3
View File
@@ -7,7 +7,7 @@
# - Safer handling for event type + arrays
#################################################################################
$dataarray = explode(",", $message->readingNotice['data']);
$dataarray = array_map('tz_expand_report', explode(",", $message->readingNotice['data']));
// ======================== CONFIG ========================
$hasHero = (!empty($dataarray[14]) && $dataarray[14] > 0);
@@ -48,7 +48,7 @@ if ($type == 1) {
<tr>
<?php $date = $generator->procMtime($message->readingNotice['time']); ?>
<td class="sent"><?php echo TZ_SENT; ?></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." at ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." ".TZ_AT." ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
</tr>
</thead>
@@ -95,7 +95,7 @@ for ($i = $start; $i <= ($start + 9); $i++) {
// HERO
if ($hasHero) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"".RC_HERO."\" alt=\"".RC_HERO."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
+3 -3
View File
@@ -7,7 +7,7 @@
# - Reduced redundant queries
#################################################################################
$dataarray = explode(",", $message->readingNotice['data']);
$dataarray = array_map('tz_expand_report', explode(",", $message->readingNotice['data']));
// ======================== CONFIG ========================
$hasHero = (isset($dataarray[184]) && $dataarray[184] > 0);
@@ -82,7 +82,7 @@ if ($database->isVillageOases($dataarray[29])) {
<tr>
<?php $date = $generator->procMtime($message->readingNotice['time']); ?>
<td class="sent"><?php echo TZ_SENT; ?></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." at ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." ".TZ_AT." ".$date[1]; ?></span> <span><?php echo TZ_HOUR; ?></span></td>
</tr>
</thead>
@@ -117,7 +117,7 @@ for ($i = $start; $i <= ($start + 9); $i++) {
}
if ($hasHero) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"".RC_HERO."\" alt=\"".RC_HERO."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
+3 -3
View File
@@ -7,7 +7,7 @@
# - Minor stability fixes
#################################################################################
$dataarray = explode(",", $message->readingNotice['data']);
$dataarray = array_map('tz_expand_report', explode(",", $message->readingNotice['data']));
// ======================== CONFIG ========================
$hasHero = (!empty($dataarray[13]) && $dataarray[13] > 0);
@@ -62,7 +62,7 @@ if ($fromName != "[?]" || $fromId == 0) {
<tr>
<?php $date = $generator->procMtime($message->readingNotice['time']); ?>
<td class="sent"><?php echo TZ_SENT; ?></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." at ".$date[1]; ?></span><span> </span></td>
<td><?php echo ON; ?> <span><?php echo $date[0]." ".TZ_AT." ".$date[1]; ?></span><span> </span></td>
</tr>
</thead>
@@ -100,7 +100,7 @@ for ($i = $start; $i <= ($start + 9); $i++) {
// hero column
if ($hasHero) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"".RC_HERO."\" alt=\"".RC_HERO."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";