From 09bd0164ebc020a54b944b7326dcba496fb5d82c Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 26 Aug 2022 22:29:23 +0200 Subject: idk when was the last commit so I'm making a new one - Violet Dawn --- includes/banner.php | 167 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 133 insertions(+), 34 deletions(-) (limited to 'includes/banner.php') diff --git a/includes/banner.php b/includes/banner.php index 48bba83..6305857 100644 --- a/includes/banner.php +++ b/includes/banner.php @@ -1,5 +1,6 @@ 4196352, + "regression" => null, + "median" => null, + "marefriends" => [], + "sisters" => [], + "caretakers" => [] + ]); $prefixes = []; foreach ($member['proxy_tags'] as $proxy) { @@ -167,14 +173,24 @@ function getMemberBannerData(string $id, string $system) { 'timestamp' => strtotime($frontingEnd["timestamp"]), 'duration' => [ 'seconds' => $seconds, - 'pretty' => $seconds . " seconds" + 'pretty' => $seconds . ($french ? " secondes" : " seconds") ] ]; - if ($seconds > 60) { - if ($seconds > 3600) { - $lastFronted['duration']['pretty'] = round($seconds / 3600) . " hours"; - } else { - $lastFronted['duration']['pretty'] = round($seconds / 60) . " minutes"; + if ($french) { + if ($seconds > 60) { + if ($seconds > 3600) { + $lastFronted['duration']['pretty'] = round($seconds / 3600) . " heures"; + } else { + $lastFronted['duration']['pretty'] = round($seconds / 60) . " minutes"; + } + } + } else { + if ($seconds > 60) { + if ($seconds > 3600) { + $lastFronted['duration']['pretty'] = round($seconds / 3600) . " hours"; + } else { + $lastFronted['duration']['pretty'] = round($seconds / 60) . " minutes"; + } } } } @@ -183,21 +199,34 @@ function getMemberBannerData(string $id, string $system) { $speciesList = []; foreach ($metadata["species"] ?? [] as $species) { - $name = match ($species) { - "earth" => $metadata["robot"] ? "Robot earth pony" : "Earth pony", - "alicorn" => $metadata["robot"] ? "Robot alicorn" : "Alicorn", - "crystal" => $metadata["robot"] ? "Robot crystal pony" : "Crystal pony", - "pegasus" => $metadata["robot"] ? "Robot pegasus" : "Pegasus", - "batpony" => $metadata["robot"] ? "Robot bat pony" : "Bat pony", - "unicorn" => $metadata["robot"] ? "Robot unicorn" : "Unicorn", - default => $species . "_" . $metadata["robot"] - }; + if ($french) { + $name = match ($species) { + "earth" => $metadata["robot"] ? "Robot poney terrestre" : (!$metadata["plush"] ? "Poney terrestre" : "Poney terrestre en peluche"), + "alicorn" => $metadata["robot"] ? "Robot alicorne" : (!$metadata["plush"] ? "Alicorne" : "Alicorne en peluche"), + "crystal" => $metadata["robot"] ? "Robot poney de crystal" : (!$metadata["plush"] ? "Poney de crystal" : "Poney de crystal en peluche"), + "pegasus" => $metadata["robot"] ? "Robot pégase" : (!$metadata["plush"] ? "Pégase" : "Pégase en peluche"), + "batpony" => $metadata["robot"] ? "Robot Poney chauve souris" : (!$metadata["plush"] ? "Poney chauve souris" : "Poney chauve souris en peluche"), + "unicorn" => $metadata["robot"] ? "Robot licorne" : (!$metadata["plush"] ? "Licorne" : "Licorne en peluche"), + default => $species . "_" . $metadata["robot"] + }; + } else { + $name = match ($species) { + "earth" => $metadata["robot"] ? "Robot earth pony" : (!$metadata["plush"] ? "Earth pony" : "Earth pony plush"), + "alicorn" => $metadata["robot"] ? "Robot alicorn" : (!$metadata["plush"] ? "Alicorn" : "Alicorn plush"), + "crystal" => $metadata["robot"] ? "Robot crystal pony" : (!$metadata["plush"] ? "Crystal pony" : "Crystal pony plush"), + "pegasus" => $metadata["robot"] ? "Robot pegasus" : (!$metadata["plush"] ? "Pegasus" : "Pegasus plush"), + "batpony" => $metadata["robot"] ? "Robot bat pony" : (!$metadata["plush"] ? "Bat pony" : "Bat pony plush"), + "unicorn" => $metadata["robot"] ? "Robot unicorn" : (!$metadata["plush"] ? "Unicorn" : "Unicorn plush"), + default => $species . "_" . $metadata["robot"] + }; + } $speciesList[] = [ "id" => $species, "name" => $name, "robot" => $metadata["robot"], - "icon" => $species . ($metadata["robot"] ? "-robot" : "") . ".png" + "plush" => $metadata["plush"], + "icon" => $species . ($metadata["robot"] ? "-robot" : ($metadata["plush"] ? "-plush" : "")) . ".png" ]; } @@ -239,7 +268,7 @@ function getMemberBannerData(string $id, string $system) { $marefriends[] = [ "id" => $marefriend, - "link" => "/" . ($mfSystem === "gdapd" ? "raindrops" : "cloudburst") . "/" . ($mfMember["name"]), + "link" => "/" . ($mfMember["name"]), "icon" => "pt" . (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $mfMember['name'] . ".png") ? "-" . $mfMember['name'] : "") . ".png", "name" => getMiniName($mfMember["display_name"] ?? $mfMember["name"]), "full_name" => $mfMember["display_name"] ?? $mfMember["name"] @@ -258,7 +287,7 @@ function getMemberBannerData(string $id, string $system) { $sisters[] = [ "id" => $marefriend, - "link" => "/" . ($mfSystem === "gdapd" ? "raindrops" : "cloudburst") . "/" . ($mfMember["name"]), + "link" => "/" . ($mfMember["name"]), "icon" => "pt" . (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $mfMember['name'] . ".png") ? "-" . $mfMember['name'] : "") . ".png", "name" => getMiniName($mfMember["display_name"] ?? $mfMember["name"]), "full_name" => $mfMember["display_name"] ?? $mfMember["name"] @@ -280,7 +309,7 @@ function getMemberBannerData(string $id, string $system) { $caretakers[] = [ "id" => $marefriend, - "link" => "/" . ($mfSystem === "gdapd" ? "raindrops" : "cloudburst") . "/" . ($mfMember["name"]), + "link" => "/" . ($mfMember["name"]), "icon" => "pt" . (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $mfMember['name'] . ".png") ? "-" . $mfMember['name'] : "") . ".png", "name" => getMiniName($mfMember["display_name"] ?? $mfMember["name"]), "full_name" => $mfMember["display_name"] ?? $mfMember["name"] @@ -295,16 +324,44 @@ function getMemberBannerData(string $id, string $system) { $badges[] = [ "id" => "host", "color" => "primary", - "html" => 'Host' + "html" => ( + $french + ? + 'Hôte' + : + 'Host' + ) ]; } } + if (($metadata["age_spells"] ?? false) && !$french) { + $badges[] = [ + "id" => "age_spells", + "color" => "primary", + "html" => 'Affected by age spells' + ]; + } + if ($metadata["fictive"] ?? false) { $badges[] = [ "id" => "fictive", "color" => "info", - "html" => 'Fictive' + "html" => ( + $french + ? + 'Fictive' + : + 'Fictive' + ) + ]; + } + + if ($member["name"] === "fusion") { + $badges[] = [ + "id" => "fusion", + "color" => "d63384", + "html" => 'Fusion' ]; } @@ -312,7 +369,13 @@ function getMemberBannerData(string $id, string $system) { $badges[] = [ "id" => "protector", "color" => "black", - "html" => 'Protector' + "html" => ( + $french + ? + '
' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' a protector in the system and will front when somepony cannot handle it anymore." class="badge rounded-pill bg-black">' . (getMemberPronouns($member['pronouns'])["gender"] === "female" ? "Protectrice" : (getMemberPronouns($member['pronouns'])["gender"] === "male" ? "Protecteur" : "Protecteur·ice")) . '
' + : + 'Protector' + ) ]; } @@ -320,7 +383,13 @@ function getMemberBannerData(string $id, string $system) { $badges[] = [ "id" => "little", "color" => "success", - "html" => 'Little' + "html" => ( + $french + ? + '
' . ucfirst(getMemberPronouns($member['pronouns'])["subjective"]) . ' ' . (getMemberPronouns($member['pronouns'])["third"] ? "is" : "are") . ' mentally younger, and therefore behaves and feels younger than the body is." class="badge rounded-pill bg-success">Petit' . (getMemberPronouns($member['pronouns'])["gender"] === "female" ? "e" : (getMemberPronouns($member['pronouns'])["gender"] === "male" ? "" : "·e")) . '
' + : + 'Little' + ) ]; } @@ -328,7 +397,13 @@ function getMemberBannerData(string $id, string $system) { $badges[] = [ "id" => "younger", "color" => "dark", - "html" => 'Younger' + "html" => ( + $french + ? + 'Plus jeune' + : + 'Younger' + ) ]; } @@ -338,13 +413,25 @@ function getMemberBannerData(string $id, string $system) { $badges[] = [ "id" => "regressor_median", "color" => "secondary", - "html" => 'Age regresses into '. (getMiniName($regression["display_name"] ?? $regression["name"])) . '' + "html" => ( + $french + ? + 'Régresse en âge en '. (getMiniName($regression["display_name"] ?? $regression["name"])) . '' + : + 'Age regresses into '. (getMiniName($regression["display_name"] ?? $regression["name"])) . '' + ) ]; } else { $badges[] = [ "id" => "regressor", "color" => "secondary", - "html" => 'Age regressor' + "html" => ( + $french + ? + 'Régresseur d\'âge' + : + 'Age regressor' + ) ]; } } @@ -355,13 +442,25 @@ function getMemberBannerData(string $id, string $system) { $badges[] = [ "id" => "regressed", "color" => "warning", - "html" => 'Age regressed from ' . (getMiniName($source["display_name"] ?? $source["name"])) . '' + "html" => ( + $french + ? + 'Régressé en âge de ' . (getMiniName($source["display_name"] ?? $source["name"])) . '' + : + 'Age regressed from ' . (getMiniName($source["display_name"] ?? $source["name"])) . '' + ) ]; } else { $badges[] = [ "id" => "facet", "color" => "light", - "html" => 'Facet of ' . getMiniName($source["display_name"] ?? $source["name"]) . '' + "html" => ( + $french + ? + 'Facette de ' . getMiniName($source["display_name"] ?? $source["name"]) . '' + : + 'Facet of ' . getMiniName($source["display_name"] ?? $source["name"]) . '' + ) ]; } } @@ -378,8 +477,8 @@ function getMemberBannerData(string $id, string $system) { 'name' => $member["display_name"] ?? $member["name"], 'badges' => $badges, 'prefixes' => $prefixes, - 'pronouns' => getTooltipsFromMark($member["pronouns"]) ?? "she/her", - 'pronouns_usage' => $prn, + 'pronouns' => getTooltipsFromMark($member["pronouns"], $french) ?? "she/her", + 'pronouns_usage' => getMemberPronouns($member['pronouns']), 'last_fronted' => $lastFronted, 'species' => $speciesList, 'system' => $systemData, -- cgit