Complete translations
authorBenjamin Auder <benjamin.auder@somewhere>
Sun, 23 Dec 2018 12:10:50 +0000 (13:10 +0100)
committerBenjamin Auder <benjamin.auder@somewhere>
Sun, 23 Dec 2018 12:10:50 +0000 (13:10 +0100)
public/javascripts/components/game.js
public/javascripts/components/problems.js
views/translations/en.pug
views/translations/fr.pug

index e4b9674..462ab9a 100644 (file)
@@ -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;
                                                }
index 7c588b2..ef017e5 100644 (file)
@@ -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() {
index 1e8555e..49e06c0 100644 (file)
                "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",
        };
index ee2e182..b4dd15f 100644 (file)
                "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",
        };