summaryrefslogtreecommitdiff
path: root/htdocs/public/metranslator/index.ejs
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/public/metranslator/index.ejs')
-rw-r--r--htdocs/public/metranslator/index.ejs49
1 files changed, 25 insertions, 24 deletions
diff --git a/htdocs/public/metranslator/index.ejs b/htdocs/public/metranslator/index.ejs
index 943d772..1433c81 100644
--- a/htdocs/public/metranslator/index.ejs
+++ b/htdocs/public/metranslator/index.ejs
@@ -1,4 +1,4 @@
-<% global.title = "MeTranslator"; %>
+<% global.title = lang.metranslator.title; %>
<%- include(`${private}/header.ejs`) %>
<a href="/">← <%- lang.global.back %></a>
@@ -15,15 +15,15 @@
}
</style>
- <h2 style="text-align:center;">Metroz Translate</h2>
- <p style="text-align:center;">💡 <i>Click one of the languages to invert</i></p>
+ <h2 style="text-align:center;"><%- lang.metranslator.title %></h2>
+ <p style="text-align:center;">💡 <i><%- lang.metranslator.tip %></i></p>
<div style="display:grid;grid-template-columns: 1fr 1fr;background:#111;padding-top:10px;border-radius:5px;">
<div>
<a style="cursor:pointer;color: white !important; text-decoration: none;" onclick="switchLangs();"><p
id="lang-source"
style="text-align:center;font-weight:bold;">
- English</p></a>
- <textarea maxlength="500" placeholder="Start typing here..." onresize="resizeTarget();"
+ <%- lang.metranslator.base %></p></a>
+ <textarea maxlength="500" placeholder="<%- lang.metranslator.placeholder %>" onresize="resizeTarget();"
onchange="process();"
onkeydown="process();" onkeyup="process();"
id="text-source"
@@ -42,16 +42,16 @@
</div>
<div id="facts"
style="background:#424242;padding: 3px 10px;width:100%;border-bottom-left-radius:5px;border-bottom-right-radius:5px;">
- <span id="facts-inner">No facts available about this text</span>
+ <span id="facts-inner"><%- lang.metranslator.facts %></span>
</div>
<details style="margin-top:20px;">
- <summary>Translator Insights</summary>
+ <summary><%- lang.metranslator.insights.title %></summary>
<ul>
- <li>Database Name: <span id="insights-01">n/a</span></li>
- <li>Database Version: <span id="insights-02">n/a</span></li>
- <li>Database Size: <span id="insights-03">n/a</span></li>
- <li>Processing Time: <span id="insights-04">n/a</span></li>
+ <li><%- lang.metranslator.insights.name %> <span id="insights-01">n/a</span></li>
+ <li><%- lang.metranslator.insights.version %> <span id="insights-02">n/a</span></li>
+ <li><%- lang.metranslator.insights.size %> <span id="insights-03">n/a</span></li>
+ <li><%- lang.metranslator.insights.time %> <span id="insights-04">n/a</span></li>
</ul>
</details>
</div>
@@ -69,10 +69,10 @@
if (document.getElementById("lang-target").innerText === "English") {
document.getElementById("lang-target").innerText = "Metroz";
- document.getElementById("lang-source").innerText = "English";
+ document.getElementById("lang-source").innerText = "<%- lang.metranslator.base %>";
} else {
document.getElementById("lang-source").innerText = "Metroz";
- document.getElementById("lang-target").innerText = "English";
+ document.getElementById("lang-target").innerText = "<%- lang.metranslator.base %>";
}
translate();
@@ -82,7 +82,7 @@
function startTyping() {
typing = true;
- document.getElementById("facts-inner").innerText = "Waiting for end of input...";
+ document.getElementById("facts-inner").innerText = "<%- lang.metranslator.waiting %>";
document.getElementById("text-target").innerText = "...";
}
@@ -97,15 +97,15 @@
function translate() {
if (document.getElementById("text-source").value.trim() === "") {
- document.getElementById("facts-inner").innerText = "No facts available for this text";
+ document.getElementById("facts-inner").innerText = "<%- lang.metranslator.facts %>";
document.getElementById("text-target").innerText = "";
return;
}
- document.getElementById("facts-inner").innerText = "Translating...";
+ document.getElementById("facts-inner").innerText = "<%- lang.metranslator.processing %>";
document.getElementById("text-target").innerText = "...";
- if (document.getElementById("lang-target").innerText === "English") {
+ if (document.getElementById("lang-target").innerText === "<%- lang.metranslator.base %>") {
target = "en";
} else {
target = "mt";
@@ -129,23 +129,24 @@
for (word of words) {
if (initw.includes(word)) {
newds.push("<mark>" + word + "</mark>");
- data.facts.push("The word '" + word + "' does not have a translation in " + document.getElementById("lang-target").innerText)
+ nothing = "<%- lang.metranslator.nothing %>";
+ data.facts.push(nothing.replace("%1", word).replace("%2", document.getElementById("lang-target").innerText))
} else {
newds.push(word);
}
}
if (data.facts.length > 0) {
- document.getElementById("facts-inner").innerHTML = "<ul style='margin-bottom: 0;'><li>" + data.facts.join("</li><li>") + "</li></ul>";
+ document.getElementById("facts-inner").innerHTML = "<ul style='margin-bottom: 0;margin-top: 0;'><li>" + data.facts.join("</li><li>") + "</li></ul>";
} else {
- document.getElementById("facts-inner").innerText = "No facts available for this text";
+ document.getElementById("facts-inner").innerText = "<%- lang.metranslator.facts %>";
}
document.getElementById("text-target").innerHTML = newds.join(" ");
} catch (e) {
console.error(e);
- document.getElementById("text-target").innerHTML = "<i>An error occurred, please try again later<ul><li>You are a developer? Additional details have been displayed in the console</li><li>You are a regular user? Contact the administrators so they fix the problem</li></ul></i>";
- document.getElementById("facts-inner").innerText = "No facts available for this text";
+ document.getElementById("text-target").innerHTML = "<%- lang.metranslator.error %>";
+ document.getElementById("facts-inner").innerText = "<%- lang.metranslator.facts %>";
document.getElementById("insights-01").innerText = "n/a";
document.getElementById("insights-02").innerText = "n/a";
document.getElementById("insights-03").innerText = "n/a";
@@ -159,8 +160,8 @@
document.getElementById("insights-04").innerText = "n/a";
} else {
document.getElementById("insights-01").innerText = data.system.name;
- document.getElementById("insights-02").innerText = data.system.version + " (last update by " + data.system.last_author + ")";
- document.getElementById("insights-03").innerText = data.system.length + " entries";
+ document.getElementById("insights-02").innerText = data.system.version + " (<%- lang.metranslator.update %> " + data.system.last_author + ")";
+ document.getElementById("insights-03").innerText = data.system.length + " <%- lang.metranslator.entries %>";
document.getElementById("insights-04").innerText = data.duration + " ms";
}
resizeTarget()