Skip to content

Commit

Permalink
fix(GameLobby): Good translations when confirming that a role is pick…
Browse files Browse the repository at this point in the history
…ed but chosen anyway. Closes #70
  • Loading branch information
antoinezanardi committed Nov 20, 2020
1 parent 03b1577 commit e5b0045
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
20 changes: 7 additions & 13 deletions src/components/GameLobby/GameLobbyRolePickerModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
},
Expand All @@ -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();
Expand Down
6 changes: 5 additions & 1 deletion src/plugins/vue-i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?",
Expand Down

0 comments on commit e5b0045

Please sign in to comment.