From e5b00459ca0ef5f95c67f6ff5b02ee14ce148c23 Mon Sep 17 00:00:00 2001 From: antoinezanardi Date: Fri, 20 Nov 2020 13:15:07 +0100 Subject: [PATCH] fix(GameLobby): Good translations when confirming that a role is picked but chosen anyway. Closes #70 --- CHANGELOG.md | 4 ++++ .../GameLobby/GameLobbyRolePickerModal.vue | 20 +++++++------------ src/plugins/vue-i18n/fr.json | 6 +++++- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb859cc..62cffdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * [#72](https://github.com/antoinezanardi/werewolves-assistant-web/issues/72) - Travis CI linked to Slack. +### 馃悰 Bug fixes + +* [#70](https://github.com/antoinezanardi/werewolves-assistant-web/issues/70) - Good translations when confirming that a role is picked but chosen anyway. + ### 馃摝 Packages * `@sentry/browser` updated to version `5.27.4`. diff --git a/src/components/GameLobby/GameLobbyRolePickerModal.vue b/src/components/GameLobby/GameLobbyRolePickerModal.vue index dfe45dc..99d18b9 100644 --- a/src/components/GameLobby/GameLobbyRolePickerModal.vue +++ b/src/components/GameLobby/GameLobbyRolePickerModal.vue @@ -231,21 +231,15 @@ export default { VueScrollTo.scrollTo(".modal-body", 500, { container: "#selected-role-panel" }); } }, - confirmPickRole(role) { - let footer = ""; - if (role.maxInGame === 1) { - footer = this.$t("RolePicker.roleWillBeSwitchedWithOtherPlayer", { roleName: this.roleText }); - } else { - footer = this.$t("RolePicker.roleWillBeSwitchedWithAnotherPlayer", { roleName: this.roleText }); - } + confirmPickRole() { return Swal.fire({ - title: this.$t("RolePicker.maxInGameReached"), - text: this.$t("RolePicker.doYouWantToSetItAnyway"), + title: this.$t("GameLobbyRolePickerModal.maxInGameReached"), + text: this.$t("GameLobbyRolePickerModal.doYouWantToSetItAnyway"), icon: "warning", showCancelButton: true, - confirmButtonText: this.$t("RolePicker.confirm"), - cancelButtonText: this.$t("RolePicker.cancel"), - footer, + confirmButtonText: this.$t("GameLobbyRolePickerModal.confirm"), + cancelButtonText: this.$t("GameLobbyRolePickerModal.cancel"), + footer: this.$t("GameLobbyRolePickerModal.roleWillBeSwitchedWithOtherPlayer"), heightAuto: false, }); }, @@ -255,7 +249,7 @@ export default { return; } if (selectedRole.maxInGame <= this.game.players.filter(player => player.role.current === selectedRole.name).length) { - const { value } = await this.confirmPickRole(selectedRole); + const { value } = await this.confirmPickRole(); if (value) { this.$emit("role-picked", this.selected); this.hide(); diff --git a/src/plugins/vue-i18n/fr.json b/src/plugins/vue-i18n/fr.json index c6ceaf9..570f307 100644 --- a/src/plugins/vue-i18n/fr.json +++ b/src/plugins/vue-i18n/fr.json @@ -124,7 +124,11 @@ "totalInGame": "0 dans la partie | 1 dans la partie | {total} dans la partie", "maxInGameReached": "Maximum atteint pour ce r么le", "totalInGameInThisRole": "Total dans la partie avec ce r么le", - "selectedPlayerAlreadyHasSelectedRole": "Le joueur s茅lectionn茅 poss猫de d茅j脿 ce r么le" + "selectedPlayerAlreadyHasSelectedRole": "Le joueur s茅lectionn茅 poss猫de d茅j脿 ce r么le", + "doYouWantToSetItAnyway": "Voulez-vous quand m锚me lui attribuer ce r么le ?", + "confirm": "Confirmer", + "cancel": "Annuler", + "roleWillBeSwitchedWithOtherPlayer": "Les r么les seront 茅chang茅s avec le joueur poss茅dant actuellement ce r么le." }, "GameLobbyTutorial": { "howToUseGameLobby": "Comment composer une 茅quipe ?",