// We opened another tab on the same game
this.mode = "idle";
this.vr = null;
- alert("Already playing a game in this variant on another tab!");
+ alert(translations[
+ "Already playing a game in this variant on another tab!"]);
break;
case "newgame": //opponent found
// oppid: opponent socket ID
{
const storageVariant = localStorage.getItem("variant");
if (!!storageVariant && storageVariant !== variant)
- return alert("Finish your " + storageVariant + " game first!");
+ {
+ return alert(translations["Finish your "] +
+ storageVariant + translations[" game first!"]);
+ }
// Send game request and wait..
try {
this.conn.send(JSON.stringify({code:"newgame", fen:fen}));
const score = localStorage.getItem("comp-score");
if (storageVariant !== variant && score == "*")
{
- if (!confirm("Unfinished " + storageVariant +
- " computer game will be erased"))
+ if (!confirm(storageVariant +
+ translations[": unfinished computer game will be erased"]))
{
return;
}
},
previewNewProblem: function() {
if (!V.IsGoodFen(this.newProblem.fen))
- return alert("Bad FEN string");
- if (this.newProblem.instructions.length == 0)
- return alert("Empty instructions");
- if (this.newProblem.solution.length == 0)
- return alert("Empty solution");
+ return alert(translations["Bad FEN string"]);
+ if (this.newProblem.instructions.trim().length == 0)
+ return alert(translations["Empty instructions"]);
+ if (this.newProblem.solution.trim().length == 0)
+ return alert(translations["Empty solution"]);
this.newProblem.stage = "preview";
},
sendNewProblem: function() {
"Preview": "Preview",
"Cancel": "Cancel",
"Solve": "Solve",
+ "Bad FEN string": "Bad FEN string",
+ "Empty instructions": "Empty instructions",
+ "Empty solution": "Empty solution",
+ "Already playing a game in this variant on another tab!":
+ "Already playing a game in this variant on another tab!",
+ "Finish your ": "Finish your ",
+ " game first!": " game first!",
+ ": unfinished computer game will be erased":
+ ": unfinished computer game will be erased",
};
"Preview": "Prévisualiser",
"Cancel": "Annuler",
"Solve": "Résoudre",
+ "Bad FEN string": "Mauvaise description FEN",
+ "Empty instructions": "Instructions vides",
+ "Empty solution": "Solution vide",
+ "Already playing a game in this variant on another tab!":
+ "Une partie est en cours sur cette variante dans un autre onglet !",
+ "Finish your ": "Terminez votre ",
+ " game first!": " partie d'abord !",
+ ": unfinished computer game will be erased":
+ " : une partie inachevée contre l'ordinateur sera effacée",
};