From 96ea219340d7858c3217823e2c734912ab5131d5 Mon Sep 17 00:00:00 2001 From: m1k1o Date: Mon, 6 Apr 2020 12:22:36 +0200 Subject: [PATCH] context added translations for modals --- client/src/components/context.vue | 28 ++++++++++++++++------------ client/src/locale/en-us.ts | 12 ++++++++++++ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/client/src/components/context.vue b/client/src/components/context.vue index af4a447..11cf348 100644 --- a/client/src/components/context.vue +++ b/client/src/components/context.vue @@ -165,11 +165,12 @@ kick(member: Member) { this.$swal({ - title: `Kick ${member.displayname}?`, - text: `Are you sure you want to kick ${member.displayname}?`, + title: this.$t('context.confirm.kick_title', { name: member.displayname }), + text: this.$t('context.confirm.kick_text', { name: member.displayname }), icon: 'warning', showCancelButton: true, - confirmButtonText: 'Yes', + confirmButtonText: this.$t('context.confirm.button_yes'), + cancelButtonText: this.$t('context.confirm.button_cancel'), }).then(({ value }) => { if (value) { this.$accessor.user.kick(member) @@ -179,11 +180,12 @@ ban(member: Member) { this.$swal({ - title: `Ban ${member.displayname}?`, - text: `Are you sure you want to ban ${member.displayname}? You will need to restart the server to undo this.`, + title: this.$t('context.confirm.ban_title', { name: member.displayname }), + text: this.$t('context.confirm.ban_text', { name: member.displayname }), icon: 'warning', showCancelButton: true, - confirmButtonText: 'Yes', + confirmButtonText: this.$t('context.confirm.button_yes'), + cancelButtonText: this.$t('context.confirm.button_cancel'), }).then(({ value }) => { if (value) { this.$accessor.user.ban(member) @@ -193,11 +195,12 @@ mute(member: Member) { this.$swal({ - title: `Mute ${member.displayname}?`, - text: `Are you sure you want to mute ${member.displayname}?`, + title: this.$t('context.confirm.mute_title', { name: member.displayname }), + text: this.$t('context.confirm.mute_text', { name: member.displayname }), icon: 'warning', showCancelButton: true, - confirmButtonText: 'Yes', + confirmButtonText: this.$t('context.confirm.button_yes'), + cancelButtonText: this.$t('context.confirm.button_cancel'), }).then(({ value }) => { if (value) { this.$accessor.user.mute(member) @@ -207,11 +210,12 @@ unmute(member: Member) { this.$swal({ - title: `Unmute ${member.displayname}?`, - text: `Are you sure you want to unmute ${member.displayname}?`, + title: this.$t('context.confirm.unmute_title', { name: member.displayname }), + text: this.$t('context.confirm.unmute_text', { name: member.displayname }), icon: 'warning', showCancelButton: true, - confirmButtonText: 'Yes', + confirmButtonText: this.$t('context.confirm.button_yes'), + cancelButtonText: this.$t('context.confirm.button_cancel'), }).then(({ value }) => { if (value) { this.$accessor.user.unmute(member) diff --git a/client/src/locale/en-us.ts b/client/src/locale/en-us.ts index 8fd05a6..cc17149 100644 --- a/client/src/locale/en-us.ts +++ b/client/src/locale/en-us.ts @@ -25,6 +25,18 @@ export const context = { give: 'Give Controls', kick: 'Kick', ban: 'Ban IP', + confirm: { + kick_title: 'Kick {name}?', + kick_text: 'Are you sure you want to kick {name}?', + ban_title: 'Ban {name}?', + ban_text: 'Are you sure you want to ban {name}? You will need to restart the server to undo this.', + mute_title: 'Mute {name}?', + mute_text: 'Are you sure you want to mute {name}?', + unmute_title: 'Unmute {name}?', + unmute_text: 'Are you sure you want to unmute {name}?', + button_yes: 'Yes', + button_cancel: 'Cancel', + } } export const controls = {