mls4error (#869)

## Description: 
I will implement MLS support for the error messages.
![スクリーンショット 2025-05-25 8 32
29](https://github.com/user-attachments/assets/90ceabe0-e12f-49e4-897a-a452f0949df3)


## 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:
Aotumuri
2025-05-25 09:13:59 +09:00
committed by GitHub
parent 8950816b3e
commit c6e8f2f998
3 changed files with 26 additions and 6 deletions
+8
View File
@@ -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."
}
}
+8
View File
@@ -392,5 +392,13 @@
"stop_trade": "貿易を停止",
"yes": "はい",
"no": "いいえ"
},
"error_modal": {
"crashed": "ゲームがクラッシュしました!",
"paste_discord": "以下の情報をDiscordのバグ報告に貼り付けてください:",
"copy_clipboard": "クリップボードにコピー",
"copied": "コピーしました!",
"failed_copy": "コピーに失敗しました",
"desync_notice": "あなたは他のプレイヤーと同期していません。画面に表示される内容が他のプレイヤーと異なる可能性があります。"
}
}
+10 -6
View File
@@ -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");