mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:10:42 +00:00
mls4error (#869)
## Description: I will implement MLS support for the error messages.  ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors
This commit is contained in:
@@ -413,5 +413,13 @@
|
||||
"stop_trade": "Stop trading",
|
||||
"yes": "Yes",
|
||||
"no": "No"
|
||||
},
|
||||
"error_modal": {
|
||||
"crashed": "Game crashed!",
|
||||
"paste_discord": "Please paste the following in your bug report in Discord:",
|
||||
"copy_clipboard": "Copy to clipboard",
|
||||
"copied": "Copied!",
|
||||
"failed_copy": "Failed to copy",
|
||||
"desync_notice": "You are desynced from other players. What you see might differ from other players."
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,5 +392,13 @@
|
||||
"stop_trade": "貿易を停止",
|
||||
"yes": "はい",
|
||||
"no": "いいえ"
|
||||
},
|
||||
"error_modal": {
|
||||
"crashed": "ゲームがクラッシュしました!",
|
||||
"paste_discord": "以下の情報をDiscordのバグ報告に貼り付けてください:",
|
||||
"copy_clipboard": "クリップボードにコピー",
|
||||
"copied": "コピーしました!",
|
||||
"failed_copy": "コピーに失敗しました",
|
||||
"desync_notice": "あなたは他のプレイヤーと同期していません。画面に表示される内容が他のプレイヤーと異なる可能性があります。"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { translateText } from "../client/Utils";
|
||||
import { consolex, initRemoteSender } from "../core/Consolex";
|
||||
import { EventBus } from "../core/EventBus";
|
||||
import {
|
||||
@@ -308,7 +309,7 @@ export class ClientGameRunner {
|
||||
this.lobby.gameStartInfo.gameID,
|
||||
this.lobby.clientID,
|
||||
true,
|
||||
"You are desynced from other players. What you see might differ from other players.",
|
||||
translateText("error_modal.desync_notice"),
|
||||
);
|
||||
}
|
||||
if (message.type === "turn") {
|
||||
@@ -497,7 +498,7 @@ function showErrorModal(
|
||||
gameID: GameID,
|
||||
clientID: ClientID,
|
||||
closable = false,
|
||||
heading = "Game crashed!",
|
||||
heading = translateText("error_modal.crashed"),
|
||||
) {
|
||||
const errorText = `Error: ${errMsg}\nStack: ${stack}`;
|
||||
|
||||
@@ -506,22 +507,25 @@ function showErrorModal(
|
||||
}
|
||||
|
||||
const modal = document.createElement("div");
|
||||
|
||||
modal.id = "error-modal";
|
||||
|
||||
const content = `${heading}\n game id: ${gameID}, client id: ${clientID}\nPlease paste the following in your bug report in Discord:\n${errorText}`;
|
||||
const content = `${translateText(heading)}\n game id: ${gameID}, client id: ${clientID}\n${translateText("error_modal.paste_discord")}\n${errorText}`;
|
||||
|
||||
// Create elements
|
||||
const pre = document.createElement("pre");
|
||||
pre.textContent = content;
|
||||
|
||||
const button = document.createElement("button");
|
||||
button.textContent = "Copy to clipboard";
|
||||
button.textContent = translateText("error_modal.copy_clipboard");
|
||||
button.className = "copy-btn";
|
||||
button.addEventListener("click", () => {
|
||||
navigator.clipboard
|
||||
.writeText(content)
|
||||
.then(() => (button.textContent = "Copied!"))
|
||||
.catch(() => (button.textContent = "Failed to copy"));
|
||||
.then(() => (button.textContent = translateText("error_modal.copied")))
|
||||
.catch(
|
||||
() => (button.textContent = translateText("error_modal.failed_copy")),
|
||||
);
|
||||
});
|
||||
|
||||
const closeButton = document.createElement("button");
|
||||
|
||||
Reference in New Issue
Block a user