Extract text from error pages and sync text variable to all lang (#1008)

* feat: extract text from error pages

* feat: sync text variables to langs.properties

---------

Co-authored-by: Anthony Stirling <77850077+Frooodle@users.noreply.github.com>
This commit is contained in:
CocoMaster-AI
2024-04-01 18:04:56 +08:00
committed by GitHub
parent 664dd62d8b
commit 989491b903
31 changed files with 651 additions and 38 deletions

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="http://www.thymeleaf.org">
<head>
<th:block th:insert="~{fragments/common :: head(title='404 - Page Not Found | Oops, we tripped in the code!')}"></th:block>
<th:block th:insert="~{fragments/common :: head(title=#{error.404.head})}"></th:block>
</head>
<body>
@@ -11,25 +11,17 @@
<div th:insert="~{fragments/errorBanner.html :: errorBanner}"></div>
<div class="container">
<div id="support-section">
<h1 class="display-2">Oops!</h1>
<p class="lead" th:if="${param.status == '404'}">
We can't seem to find the page you're looking for.
</p>
<p class="lead" th:unless="${param.status == '404'}">
Something went wrong
</p>
<h1 class="display-2" th:text="#{oops}"></h1>
<p class="lead" th:if="${param.status == '404'}" th:text="#{error.404.1}"></p>
<p class="lead" th:unless="${param.status == '404'}" th:text="#{error.404.2}"></p>
<br>
<h2>Need help / Found a issue?</h2>
<p>
If you're still having trouble, don't hesitate to reach out to us
for help. You can submit a ticket on our GitHub page or contact us
through Discord:
</p>
<h2 th:text="#{error.needHelp}"></h2>
<p th:text="#{error.contactTip}"></p>
<div id="button-group">
<a href="https://github.com/Stirling-Tools/Stirling-PDF/issues" id="github-button" target="_blank">Submit a ticket on GitHub</a>
<a href="https://discord.gg/Cn8pWhQRxZ" id="discord-button" target="_blank">Join our Discord server</a>
<a href="https://github.com/Stirling-Tools/Stirling-PDF/issues" id="github-button" target="_blank" th:text="#{error.github}"></a>
<a href="https://discord.gg/Cn8pWhQRxZ" id="discord-button" target="_blank" th:text="#{joinDiscord}"></a>
</div>
<a href="/" class="home-button">Go back to homepage</a>
<a href="/" class="home-button" th:text="#{goHomepage}"></a>
</div>
</div>
</div>

View File

@@ -4,8 +4,8 @@
<div id="errorContainer" th:if="${message}" class="alert alert-danger alert-dismissible fade show" role="alert">
<h4 class="alert-heading" th:text="'Error: ' + ${status} + ' ' + ${error}"></h4>
<p th:text="${message} + ' for path: ' + ${path}"></p>
<button type="button" class="btn btn-danger" th:if="${trace}" onclick="toggletrace()">Show Stack Trace</button>
<button type="button" class="btn btn-secondary" th:if="${trace}" onclick="copytrace()">Copy Stack Trace</button>
<button type="button" class="btn btn-danger" th:if="${trace}" onclick="toggletrace()" th:text="#{error.showStack}"></button>
<button type="button" class="btn btn-secondary" th:if="${trace}" onclick="copytrace()" th:text="#{error.copyStack}"></button>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" onclick="dismissError()"></button>
<!-- Stack trace section -->
<div id="trace" th:if="${trace}" style="max-height: 0; overflow: hidden;">
@@ -13,8 +13,8 @@
<pre id="traceContent" th:text="${trace}"></pre>
</div>
<!-- Buttons to submit a ticket on GitHub and join Discord server -->
<a href="https://github.com/Stirling-Tools/Stirling-PDF/issues" id="github-button" target="_blank">Submit a ticket on GitHub</a>
<a href="https://discord.gg/Cn8pWhQRxZ" id="discord-button" target="_blank">Join our Discord server</a>
<a href="https://github.com/Stirling-Tools/Stirling-PDF/issues" id="github-button" target="_blank" th:text="#{error.github}"></a>
<a href="https://discord.gg/Cn8pWhQRxZ" id="discord-button" target="_blank" th:text="#{joinDiscord}"></a>
</div>
</div>
<script>

View File

@@ -1,10 +1,10 @@
<th:block th:fragment="errorBannerPerPage">
<div id="errorContainer" class="alert alert-danger alert-dismissible fade show" role="alert" style="display: none;">
<h4 class="alert-heading">Error</h4>
<h4 class="alert-heading" th:text="#{error}"></h4>
<p></p>
<button type="button" class="btn btn-danger" onclick="toggletrace()">Show Stack Trace</button>
<button type="button" class="btn btn-secondary" onclick="copytrace()">Copy Stack Trace</button>
<button type="button" class="btn btn-info" onclick="showHelp()">Help</button>
<button type="button" class="btn btn-danger" onclick="toggletrace()" th:text="#{error.showStack}"></button>
<button type="button" class="btn btn-secondary" onclick="copytrace()" th:text="#{error.copyStack}"></button>
<button type="button" class="btn btn-info" onclick="showHelp()" th:text="#{help}"></button>
<button type="button" class="close" data-bs-dismiss="alert" aria-label="Close" onclick="dismissError()">
<span aria-hidden="true">&times;</span>
</button>
@@ -20,7 +20,7 @@
<div class="modal-dialog modal-dialog-centered" role="document" id="helpModalDialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="helpModalLabel">Help</h5>
<h5 class="modal-title" id="helpModalLabel" th:text="#{help}"></h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
@@ -28,17 +28,17 @@
<div class="modal-body">
<div class="container">
<div id="support-section">
<h1 class="display-2">Oops!</h1>
<p class="lead">Sorry for the issue!.</p>
<h1 class="display-2" th:text="#{oops}"></h1>
<p class="lead" th:text="#{error.sorry}"></p>
<br>
<h2>Need help / Found an issue?</h2>
<p>If you're still having trouble, don't hesitate to reach out to us for help. You can submit a ticket on our GitHub page or contact us through Discord:</p>
<h2 th:text="#{error.needHelp}"></h2>
<p th:text="#{error.contactTip}"></p>
<div id="button-group">
<a href="https://github.com/Stirling-Tools/Stirling-PDF/issues" id="github-button" target="_blank">GitHub - Submit a ticket</a>
<a href="https://discord.gg/Cn8pWhQRxZ" id="discord-button" target="_blank">Discord - Submit Support post</a>
<a href="https://github.com/Stirling-Tools/Stirling-PDF/issues" id="github-button" target="_blank" th:text="#{error.githubSubmit}"></a>
<a href="https://discord.gg/Cn8pWhQRxZ" id="discord-button" target="_blank" th:text="#{error.discordSubmit}"></a>
</div>
<a href="/" class="home-button">Go to Homepage</a>
<a data-bs-dismiss="modal" class="home-button">Close</a>
<a href="/" class="home-button" th:text="#{goHomepage}"></a>
<a data-bs-dismiss="modal" class="home-button" th:text="#{close}"></a>
</div>
</div>
</div>

View File

@@ -1,15 +1,15 @@
<footer th:fragment="footer" id="footer" class="text-center py-3">
<div class="footer-center">
<a href="https://github.com/Stirling-Tools/Stirling-PDF" target="_blank" class="mx-1" title="Visit Github Repository">
<a href="https://github.com/Stirling-Tools/Stirling-PDF" target="_blank" class="mx-1" th:title="#{visitGithub}">
<img src="images/github.svg" alt="github">
</a>
<a href="https://hub.docker.com/r/frooodle/s-pdf" target="_blank" class="mx-1" title="See Docker Hub">
<a href="https://hub.docker.com/r/frooodle/s-pdf" target="_blank" class="mx-1" th:title="#{seeDockerHub}">
<img src="images/docker.svg" alt="docker">
</a>
<a href="https://discord.gg/Cn8pWhQRxZ" target="_blank" class="mx-1" title="Join Discord Channel">
<a href="https://discord.gg/Cn8pWhQRxZ" target="_blank" class="mx-1" th:title="#{joinDiscord}">
<img src="images/discord.svg" alt="discord">
</a>
<a href="https://github.com/sponsors/Frooodle" target="_blank" class="mx-1" title="Donate">
<a href="https://github.com/sponsors/Frooodle" target="_blank" class="mx-1" th:title="#{donate}">
<img src="images/suit-heart-fill.svg" alt="suit-heart-fill">
</a>
</div>