From 1a68d9ea31dbf88bce627c8c776d3676c79004a2 Mon Sep 17 00:00:00 2001 From: kmitresse Date: Wed, 12 Jun 2024 13:23:07 +0200 Subject: [PATCH] feat: devweb - Make translations on game room page --- .../src/main/webapp/WEB-INF/pages/game.jsp | 64 +++++----- .../src/main/webapp/WEB-INF/translations.json | 120 +++++++++++++++++- 2 files changed, 152 insertions(+), 32 deletions(-) diff --git a/S2/DevWeb/Projet/src/main/webapp/WEB-INF/pages/game.jsp b/S2/DevWeb/Projet/src/main/webapp/WEB-INF/pages/game.jsp index f31d921..d56b15a 100644 --- a/S2/DevWeb/Projet/src/main/webapp/WEB-INF/pages/game.jsp +++ b/S2/DevWeb/Projet/src/main/webapp/WEB-INF/pages/game.jsp @@ -1,9 +1,11 @@ +<%@ page import="uppa.project.web.translation.Translator" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@taglib prefix="layout" tagdir="/WEB-INF/tags/layouts" %> <%@taglib prefix="component" tagdir="/WEB-INF/tags/components" %> +<% Translator translator = (Translator) request.getSession().getAttribute("translator"); %> - + @@ -13,18 +15,19 @@
- + - + @@ -33,14 +36,15 @@
- + -

Créé le: ${game.createdAt.toLocaleString()}

-

Difficulté: ${game.difficulty}

-

Nombre de tours: ${game.nbRounds}

-

Nombre de couleurs: ${game.nbColors}

-

Valeurs par couleur: ${game.nbValuesPerColor}

+

${translator.translate('game_information_created_at')} ${game.createdAt.toLocaleString()}

+

${translator.translate('game_information_difficulty')} ${game.difficulty}

+

${translator.translate('game_information_rounds_number')} ${game.nbRounds}

+

${translator.translate('game_information_rounds_duration')} ${game.timer} ${translator.translate('timer_unit')}

+

${translator.translate('game_information_deck_color_number')} ${game.nbColors}

+

${translator.translate('game_information_deck_value_number')} ${game.nbValuesPerColor}

@@ -51,12 +55,12 @@
-

-

- - - - +

${translator.translate('game_round')}

+

${translator.translate('game_timer')}

+ + + +
@@ -70,20 +74,20 @@
Joueur${translator.translate('game_room_player')}
- - - - - - - + + + + + + + @@ -224,12 +228,12 @@ let timerInterval; // Display timer - document.querySelector('#timer').innerText = "Temps restant: " + remainingTime + "s"; + document.querySelector('#timer').innerText = remainingTime + "s"; const interval = () => { remainingTime--; - document.querySelector('#timer').innerText = "Temps restant: " + remainingTime + "s"; + document.querySelector('#timer').innerText = remainingTime + "s"; if (remainingTime <= 0) clearInterval(timerInterval); } @@ -292,7 +296,7 @@ round.innerText = ""; // Show current round - round.innerText = "Manche " + (currentGame.currentRound + 1) + round.innerText = (currentGame.currentRound + 1) // Show other player cards game.players @@ -345,7 +349,7 @@ clearInterval(timerInterval); remainingTime = timer; - document.querySelector('#timer').innerText = "Temps restant: " + remainingTime + "s"; + document.querySelector('#timer').innerText = remainingTime + "s"; timerInterval = setInterval(interval, 1000); // Reset content @@ -357,7 +361,7 @@ choice.querySelectorAll('button').forEach(button => button.disabled = false); // Show the current round - round.innerText = "Manche " + (currentGame.currentRound + 1) + round.innerText = (currentGame.currentRound + 1) // Show other player cards game.players diff --git a/S2/DevWeb/Projet/src/main/webapp/WEB-INF/translations.json b/S2/DevWeb/Projet/src/main/webapp/WEB-INF/translations.json index b896b2d..08d0efc 100644 --- a/S2/DevWeb/Projet/src/main/webapp/WEB-INF/translations.json +++ b/S2/DevWeb/Projet/src/main/webapp/WEB-INF/translations.json @@ -251,11 +251,11 @@ "FR": "Victoires" }, "global_statistics_corrects_clics": { - "EN": "Corrects clics", + "EN": "Corrects clicks", "FR": "Clics corrects" }, "global_statistics_rapid_clics": { - "EN": "Rapid clics", + "EN": "Rapid clicks", "FR": "Clics rapides" }, "statistics_games_played" : { @@ -478,5 +478,121 @@ "new_game_create" : { "EN": "Create game", "FR": "Créer la partie" + }, + "game_room_title" : { + "EN": "Game room", + "FR": "Salle de jeu" + }, + "game_room_players_list" : { + "EN": "Players list in the game", + "FR": "Liste des joueurs dans la partie" + }, + "game_room_connected_users_list" : { + "EN": "List of connected users", + "FR": "Liste des utilisateurs connectés" + }, + "game_room_player" : { + "EN": "Player", + "FR": "Joueur" + }, + "game_room_add_player" : { + "EN": "Add player", + "FR": "Ajouter un joueur" + }, + "game_room_start_game" : { + "EN": "Start game", + "FR": "Démarrer la partie" + }, + "game_room_leave_game" : { + "EN": "Leave game", + "FR": "Quitter la partie" + }, + "game_room_player_username" : { + "EN": "Username", + "FR": "Nom d'utilisateur" + }, + "game_room_player_played_games" : { + "EN": "Played games", + "FR": "Parties jouées" + }, + "game_room_player_wins" : { + "EN": "Wins", + "FR": "Victoires" + }, + "game_room_player_average_score" : { + "EN": "Average score", + "FR": "Score moyen" + }, + "game_room_player_correct_clicks" : { + "EN": "Correct clicks", + "FR": "Clics corrects" + }, + "game_room_player_rapid_clicks" : { + "EN": "Rapid clicks", + "FR": "Clics rapides" + }, + "game_room_player_action" : { + "EN": "Action", + "FR": "Action" + }, + "game_room_player_invite" : { + "EN": "Invite", + "FR": "Inviter" + }, + "game_information_title" : { + "EN": "Game information", + "FR": "Informations de la partie" + }, + "game_information_created_at" : { + "EN": "Created at", + "FR": "Créée le" + }, + "game_information_difficulty" : { + "EN": "Difficulty", + "FR": "Difficulté" + }, + "game_information_rounds_number" : { + "EN": "Number of rounds", + "FR": "Nombre de manches" + }, + "game_information_rounds_duration" : { + "EN": "Duration of a round", + "FR": "Durée d'une manche" + }, + "game_information_deck_color_number" : { + "EN": "Number of colors", + "FR": "Nombre de couleurs" + }, + "game_information_deck_value_number" : { + "EN": "Number of values per color", + "FR": "Nombre de valeurs par couleur" + }, + "timer_unit" : { + "EN": "seconds", + "FR": "secondes" + }, + "game_same_card" : { + "EN": "Same cards", + "FR": "Mêmes cartes" + }, + "game_same_color" : { + "EN": "Same color", + "FR": "Même couleur" + }, + "game_same_value" : { + "EN": "Same value", + "FR": "Même valeur" + }, + "game_none" : { + "EN": "None", + "FR": "Aucun" + }, + "game_round" : { + "EN": "Round", + "FR": "Manche" + }, + "game_timer" : { + "EN": "Remaining time:", + "FR": "Temps restant :" } }
UtilisateurNombre de parties jouéesNombre de victoiresScore moyenClics correctsClics rapidesAction${translator.translate('game_room_player_username')}${translator.translate('game_room_player_played_games')}${translator.translate('game_room_player_wins')}${translator.translate('game_room_player_average_score')}${translator.translate('game_room_player_correct_clicks')}${translator.translate('game_room_player_rapid_clicks')}${translator.translate('game_room_player_action')}