From: Benjamin Auder Date: Sun, 23 Dec 2018 12:10:50 +0000 (+0100) Subject: Complete translations X-Git-Url: https://git.auder.net/variants/current/vendor/pieces/common.css?a=commitdiff_plain;h=6b5517b4cdd12d7480b811c94c134982c16d3814;p=vchess.git Complete translations --- diff --git a/public/javascripts/components/game.js b/public/javascripts/components/game.js index e4b96748..462ab9a4 100644 --- a/public/javascripts/components/game.js +++ b/public/javascripts/components/game.js @@ -1008,7 +1008,8 @@ Vue.component('my-game', { // 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 @@ -1278,7 +1279,10 @@ Vue.component('my-game', { { 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})); @@ -1304,8 +1308,8 @@ Vue.component('my-game', { 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; } diff --git a/public/javascripts/components/problems.js b/public/javascripts/components/problems.js index 7c588b24..ef017e59 100644 --- a/public/javascripts/components/problems.js +++ b/public/javascripts/components/problems.js @@ -105,11 +105,11 @@ Vue.component('my-problems', { }, 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() { diff --git a/views/translations/en.pug b/views/translations/en.pug index 1e8555ee..49e06c05 100644 --- a/views/translations/en.pug +++ b/views/translations/en.pug @@ -72,4 +72,13 @@ "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", }; diff --git a/views/translations/fr.pug b/views/translations/fr.pug index ee2e1829..b4dd15f5 100644 --- a/views/translations/fr.pug +++ b/views/translations/fr.pug @@ -72,4 +72,13 @@ "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", };