From: Benjamin Auder Date: Sat, 8 Feb 2020 14:06:58 +0000 (+0100) Subject: Translations X-Git-Url: https://git.auder.net/variants/img/current/%7B%7B%20asset%28%27mixstore/DESCRIPTION?a=commitdiff_plain;h=fcbc92c26e382e425d3d4cc4910eaf1a1d61c989;p=vchess.git Translations --- diff --git a/client/src/translations/about/en.pug b/client/src/translations/about/en.pug index 695c27ee..fed63220 100644 --- a/client/src/translations/about/en.pug +++ b/client/src/translations/about/en.pug @@ -1,57 +1,46 @@ -p. - This website was born after Patrick Bernier told me about - a variant he invented, called 'l'Échiqueté', which involves mixed pieces, - half-black and half-white. Back then in 2012, I developed a small website - allowing to play by correspondance with this variant only. I already had - in mind other variants to be added to the website, 'Zen chess' being the - first on the list because it changed so much the thinking process that I - was very curious to play it. +h3 History p. - After a long break, a prototype website allowing to play - live games was tested in the end of 2017, with only a few players. - One year later the first version of the final website was published: - it offered three modes, against a human, a computer engine or analyzing, - with about twenty variants available. The current website is a more modern - rewriting of this initial version: it now has the basic features expected - from a chess playing website :) + This website was born after Patrick Bernier told me about + a variant he invented: l'Échiqueté ('Checkered' here), which involves + pieces that both sides can play. + Back then in 2012, I developed a small website allowing to play this variant + by correspondance. + A few years later I had a prototype to play in live, then other variants + were added and the website was improved to be more attractive. -p. - From the main Hall, you can see and talk to online players, - send and accept challenges (live or correspondance), and also watch current - games. If this is your first contact with chess variants, you probably should - start with the 'Variants' page from the top menu: it explains all the rules - and allows to observe sample games or play against basic bots. Finally, - at any moment in a game you can click on the 'Analyze' button to analyze - the position. Try not to do that in live games, your opponent would know ;) +h3 Contribute p - a(href="https://github.com/yagu0/vchess") The source code - | is freely available on Github: the main ingredients are Express, Node.js, - | Vue and Webpack. The chosen DBMS is SQLite for now because of its simplicity. - | It can be easily changed if needed later. All contributions are welcome: + a(href="https://github.com/yagu0/vchess") The source code + |  is freely available on Github: the main ingredients are Express, Node.js, + | Vue and Webpack. The chosen DBMS is SQLite for now at least. + | All contributions are welcome: ul li Translations: see client/src/translations/ folder li. Styling: see <style> parts of .vue files in client/src/{components,views} - li. - Back-end and front-end code: a lot can be improved! - Feel free to send pull requests :) + li The code in general: see section 'Issues' on Github + +h3 Acknowledgments p - | A considerable number of people helped for this website, - | testing, giving ideas, motivating me to achieve this project. Thanks in - | relatively random order to Patrick Bernier, Frédéric Fradet, Olive Martin, - | Bevis Martin, Laurent Nouhaud and Christian Poisson for early testing and - | advices from 2012; to Yovann Gatineau and Anatole Vlachos for their - | enthusiasm about the website; to Jérôme Auclair who told me about the - | Dynamo variant; to Nathalie Merlin and lichess players O42, oceansideview, - | okei and opperwezen who tested - a(href="https://lichess.org/forum/general-chess-discussion/vchessclub--play-chess-variants?page=10") the 2018/12 version - | ; and of course to the websites - a(href="https://schemingmind.com/") schemingmind.com - | and - a(href="https://www.chessvariants.com/") chessvariants.com - | which are two great resources about variants. - | If I forget someone in this list, sorry and please tell me! + | Quite many people helped for this website, + | testing, giving ideas, motivating me to achieve this project. + | To avoid writing a long list I will only mention two groups: + | thanks to + ul + li. + Patrick Bernier [*], Frédéric Fradet, Olive Martin, Bevis Martin, + Laurent Nouhaud and Christian Poisson (version 2012 [*] and subsequent); + li + | Nathalie Merlin and lichess players O42, oceansideview, okei and + | opperwezen who tried + a(href="https://lichess.org/forum/general-chess-discussion/vchessclub--play-chess-variants?page=10") the 2018/12 version + | . + | Finally, the websites + a(href="https://www.chessvariants.com/") chessvariants.com + |  and + a(href="https://schemingmind.com/") schemingmind.com + |  were very helpful. diff --git a/client/src/translations/about/es.pug b/client/src/translations/about/es.pug new file mode 100644 index 00000000..9adcbeca --- /dev/null +++ b/client/src/translations/about/es.pug @@ -0,0 +1,43 @@ +h3 Historia + +p. + Este sitio nació después de una discusión con Patrick Bernier, quien me contó + habló sobre una variante de su invención : l'Échiqueté ('Checkered' aquí), + involucrando piezas que pueden ser jugadas por ambos lados. + En 2012, desarrollé un primer sitio pequeño permitiendo jugar esta + variante por correspondencia. Unos años mas tarde tuve un prototipo + para jugar en vivo, y luego otras variantes se agregaron + y el sitio finalmente se hizo más atractivo. + +h3 Contribuir + +p + a(href="https://github.com/yagu0/vchess") El código fuente + |  es de libre acceso en Github : los ingredientes principales son + | Express, Node.js, Vue y Webpack. SQLite ha sido elegido como DBMS al + | menos por el momento. Cualquier contribución es bienvenida : + ul + li Traducciones : carpeta client/src/translations/ + li Estilo : secciónes <style> de los archivos .vue en client/src/{components,views} + li Código en general : sección 'Issues' en Github. + +h3 Agradecimientos + +p + | Mucha gente ayudó en este sitio, probando, dando ideas, motivándome a + | completar el proyecto. Para no escribir demasiado, solo mencionaré dos + | grupos: gracias a + ul + li. + Patrick Bernier [*], Frédéric Fradet, Olive Martin, Bevis Martin, + Laurent Nouhaud y Christian Poisson (versión 2012 [*] y subsiguiente) ; + li + | Nathalie Merlin y los jugadores lichess O42, oceansideview, okei y + | opperwezen que han probado + a(href="https://lichess.org/forum/general-chess-discussion/vchessclub--play-chess-variants?page=10") la versión 2018/12 + | . + | Finalmente, los sitios + a(href="https://www.chessvariants.com/") chessvariants.com + |  y + a(href="https://schemingmind.com/") schemingmind.com + |  han sido de mucha ayuda. diff --git a/client/src/translations/about/fr.pug b/client/src/translations/about/fr.pug new file mode 100644 index 00000000..b9213789 --- /dev/null +++ b/client/src/translations/about/fr.pug @@ -0,0 +1,43 @@ +h3 Histoire + +p. + Ce site est né à la suite d'une discussion avec Patrick bernier, qui m'avait + parlé d'une variante de son invention : l'Échiqueté ('Checkered' ici), + impliquant des pièces pouvant être jouées par les deux camps. + À l'époque en 2012, j'ai développé un premier petit site + permettant de jouer à cette variante par correspondance. Quelques années plus + tard je disposais d'un prototype pour jouer en direct, puis d'autres + variantes se sont ajoutées et le site a finalement été rendu plus attractif. + +h3 Contribuer + +p + a(href="https://github.com/yagu0/vchess") Le code source + |  est librement accessible sur Github : les principaux ingrédients sont + | Express, Node.js, Vue et Webpack. SQLite a été choisi comme SGBD pour + | le moment au moins. Toute contribution est la bienvenue : + ul + li Traductions : dossier client/src/translations/ + li Style : sections <style> des fichiers .vue dans client/src/{components,views} + li Code en général : section 'Issues' sur Github. + +h3 Remerciements + +p + | Pas mal de gens ont aidé sur ce site, en testant, donnant des idées, me + | motivant pour achever le projet. Afin de ne pas en écrire des tartines je + | ne mentionnerai que deux groupes : merci à + ul + li. + Patrick Bernier [*], Frédéric Fradet, Olive Martin, Bevis Martin, + Laurent Nouhaud et Christian Poisson (version 2012 [*] et ultérieures) ; + li + | Nathalie Merlin et les joueurs lichess O42, oceansideview, okei et + | opperwezen qui ont essayé + a(href="https://lichess.org/forum/general-chess-discussion/vchessclub--play-chess-variants?page=10") la version 2018/12 + | . + | Enfin, les sites + a(href="https://www.chessvariants.com/") chessvariants.com + |  et + a(href="https://schemingmind.com/") schemingmind.com + |  ont été très utiles. diff --git a/client/src/views/About.vue b/client/src/views/About.vue index 36c01ef3..3b1a2cb9 100644 --- a/client/src/views/About.vue +++ b/client/src/views/About.vue @@ -10,18 +10,13 @@ import { store } from "@/store"; export default { name: 'my-about', - data: function() { - return { - st: store.state, - content: "", - }; - }, - mounted: function() { - this.content = - require("raw-loader!@/translations/about/" + this.st.lang + ".pug") - // Next two lines fix a weird issue after last update (2019-11) - .replace(/\\[n"]/g, " ") - .replace('module.exports = "', '').replace(/"$/, ""); + computed: { + content: function() { + return require("raw-loader!@/translations/about/" + store.state.lang + ".pug") + // Next two lines fix a weird issue after last update (2019-11) + .replace(/\\[n"]/g, " ") + .replace('module.exports = "', '').replace(/"$/, ""); + }, }, }; diff --git a/client/src/views/Rules.vue b/client/src/views/Rules.vue index b6a374aa..1f9a0a44 100644 --- a/client/src/views/Rules.vue +++ b/client/src/views/Rules.vue @@ -31,12 +31,11 @@ export default { data: function() { return { st: store.state, - content: "", display: "rules", gameInProgress: false, // variables passed to ComputerGame: gameInfo: { - vname: "_unknown", + vname: "", mode: "versus", fen: "", score: "*", @@ -45,12 +44,25 @@ export default { }, watch: { "$route": function(newRoute) { - this.tryChangeVariant(newRoute.params["vname"]); + this.re_setVariant(newRoute.params["vname"]); }, }, created: async function() { // NOTE: variant cannot be set before store is initialized - this.tryChangeVariant(this.$route.params["vname"]); + this.re_setVariant(this.$route.params["vname"]); + }, + computed: { + content: function() { + if (!this.gameInfo.vname) + return ""; //variant not set yet + // (AJAX) Request to get rules content (plain text, HTML) + return require("raw-loader!@/translations/rules/" + + this.gameInfo.vname + "/" + this.st.lang + ".pug") + // Next two lines fix a weird issue after last update (2019-11) + .replace(/\\n/g, " ").replace(/\\"/g, '"') + .replace('module.exports = "', '').replace(/"$/, "") + .replace(/(fen:)([^:]*):/g, this.replaceByDiag); + }, }, methods: { clickReadRules: function() { @@ -68,24 +80,15 @@ export default { shadow: fenParts[3], }; }, - tryChangeVariant: async function(vname) { - if (!vname || vname == "_unknown") - return; - this.gameInfo.vname = vname; + // Method to replace diagrams in loaded HTML + replaceByDiag: function(match, p1, p2) { + const args = this.parseFen(p2); + return getDiagram(args); + }, + re_setVariant: async function(vname) { const vModule = await import("@/variants/" + vname + ".js"); window.V = vModule.VariantRules; - // Method to replace diagrams in loaded HTML - const replaceByDiag = (match, p1, p2) => { - const args = this.parseFen(p2); - return getDiagram(args); - }; - // (AJAX) Request to get rules content (plain text, HTML) - this.content = - require("raw-loader!@/translations/rules/" + vname + "/" + this.st.lang + ".pug") - // Next two lines fix a weird issue after last update (2019-11) - .replace(/\\n/g, " ").replace(/\\"/g, '"') - .replace('module.exports = "', '').replace(/"$/, "") - .replace(/(fen:)([^:]*):/g, replaceByDiag); + this.gameInfo.vname = vname; }, startGame: function(mode) { if (this.gameInProgress) diff --git a/server/routes/users.js b/server/routes/users.js index abe987cd..ebc77cce 100644 --- a/server/routes/users.js +++ b/server/routes/users.js @@ -33,7 +33,7 @@ router.get("/whoami", access.ajax, (req,res) => { // NOTE: this method is safe because only IDs and names are returned router.get("/users", access.ajax, (req,res) => { const ids = req.query["ids"]; - if (!ids.match(/^([0-9]+,?)+$/)) //NOTE: slightly too permissive + if (!!ids && !ids.match(/^([0-9]+,?)+$/)) //NOTE: slightly too permissive return res.json({errmsg: "Bad IDs array"}); UserModel.getByIds(ids, (err,users) => { if (!!err)