From aba07b30964bf5eae244db4a12f0638b5c6f9fbd Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Sat, 14 Jun 2025 22:24:41 +0530 Subject: [PATCH] fix transalations for webhooks --- frontend/src/App.vue | 1 - .../src/features/admin/webhooks/WebhookForm.vue | 10 ++++++---- .../features/admin/webhooks/dataTableColumns.js | 12 ++++++++---- .../admin/webhooks/dataTableDropdown.vue | 16 ++++++++++++---- .../views/admin/webhooks/CreateEditWebhook.vue | 14 ++++++++++---- i18n/en.json | 6 +++++- i18n/mr.json | 7 +++++++ 7 files changed, 48 insertions(+), 18 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index b75fa2da..78ee23db 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -212,7 +212,6 @@ const deleteView = async (view) => { }) } catch (err) { emitter.emit(EMITTER_EVENTS.SHOW_TOAST, { - title: 'Error', variant: 'destructive', description: handleHTTPError(err).message }) diff --git a/frontend/src/features/admin/webhooks/WebhookForm.vue b/frontend/src/features/admin/webhooks/WebhookForm.vue index 6386c2c0..9aec4c47 100644 --- a/frontend/src/features/admin/webhooks/WebhookForm.vue +++ b/frontend/src/features/admin/webhooks/WebhookForm.vue @@ -22,8 +22,10 @@ - Events - Select which events should trigger this webhook + {{ $t('globals.terms.event', 2) }} + + {{ $t('admin.webhook.events.description') }} +
{{ $t('globals.terms.secret') }} - + - Optional secret key for webhook signature verification + {{ $t('admin.webhook.secret.description') }} diff --git a/frontend/src/features/admin/webhooks/dataTableColumns.js b/frontend/src/features/admin/webhooks/dataTableColumns.js index 7cf391f1..81d64f4d 100644 --- a/frontend/src/features/admin/webhooks/dataTableColumns.js +++ b/frontend/src/features/admin/webhooks/dataTableColumns.js @@ -20,18 +20,22 @@ export const createColumns = (t) => [ }, cell: function ({ row }) { const url = row.getValue('url') - return h('div', { class: 'text-center font-mono text-sm max-w-xs truncate' }, url) + return h('div', { class: 'text-center font-mono text-sm max-w-sm truncate' }, url) } }, { accessorKey: 'events', header: function () { - return h('div', { class: 'text-center' }, 'Events') + return h('div', { class: 'text-center' }, t('globals.terms.event', 2)) }, cell: function ({ row }) { const events = row.getValue('events') return h('div', { class: 'text-center' }, [ - h(Badge, { variant: 'secondary', class: 'text-xs' }, `${events.length} events`) + h( + Badge, + { variant: 'secondary', class: 'text-xs' }, + () => `${events.length} ${t('globals.terms.event', 2)}` + ) ]) } }, @@ -47,7 +51,7 @@ export const createColumns = (t) => [ variant: isActive ? 'default' : 'secondary', class: 'text-xs' }, - isActive ? t('globals.terms.active') : t('globals.terms.inactive') + () => isActive ? t('globals.terms.active') : t('globals.terms.inactive') ) ]) } diff --git a/frontend/src/features/admin/webhooks/dataTableDropdown.vue b/frontend/src/features/admin/webhooks/dataTableDropdown.vue index ebc357b3..9027cb6e 100644 --- a/frontend/src/features/admin/webhooks/dataTableDropdown.vue +++ b/frontend/src/features/admin/webhooks/dataTableDropdown.vue @@ -17,7 +17,13 @@ props.webhook.is_active ? $t('globals.messages.disable') : $t('globals.messages.enable') }} - Send Test + + {{ + $t('globals.messages.send', { + name: $t('globals.terms.test').toLowerCase() + }) + }} + {{ $t('globals.messages.delete') }} @@ -114,7 +120,7 @@ async function handleToggle() { model: 'webhook' }) emit.emit(EMITTER_EVENTS.SHOW_TOAST, { - title: 'Success', + variant: 'success', description: t('globals.messages.updatedSuccessfully', { name: t('globals.terms.webhook') }) @@ -131,8 +137,10 @@ async function handleTest() { try { await api.testWebhook(props.webhook.id) emit.emit(EMITTER_EVENTS.SHOW_TOAST, { - title: 'Success', - description: 'Test webhook sent successfully' + variant: 'success', + description: t('globals.messages.sentSuccessfully', { + name: t('globals.terms.webhook') + }) }) } catch (error) { emit.emit(EMITTER_EVENTS.SHOW_TOAST, { diff --git a/frontend/src/views/admin/webhooks/CreateEditWebhook.vue b/frontend/src/views/admin/webhooks/CreateEditWebhook.vue index 8916008d..18342bb1 100644 --- a/frontend/src/views/admin/webhooks/CreateEditWebhook.vue +++ b/frontend/src/views/admin/webhooks/CreateEditWebhook.vue @@ -17,7 +17,11 @@ :isLoading="testLoading" @click="handleTestWebhook" > - Send Test + {{ + $t('globals.messages.send', { + name: t('globals.terms.test').toLowerCase() + }) + }}
@@ -89,7 +93,7 @@ const onSubmit = form.handleSubmit(async (values) => { }) } emitter.emit(EMITTER_EVENTS.SHOW_TOAST, { - title: 'Success', + variant: 'success', description: toastDescription }) } catch (error) { @@ -109,8 +113,10 @@ const handleTestWebhook = async () => { testLoading.value = true await api.testWebhook(props.id) emitter.emit(EMITTER_EVENTS.SHOW_TOAST, { - title: 'Success', - description: 'Test webhook sent successfully' + variant: 'success', + description: t('globals.messages.sentSuccessfully', { + name: t('globals.terms.webhook') + }) }) } catch (error) { emitter.emit(EMITTER_EVENTS.SHOW_TOAST, { diff --git a/i18n/en.json b/i18n/en.json index 8b2f10d5..e8ac9717 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -131,6 +131,7 @@ "globals.terms.download": "Download | Downloads", "globals.terms.import": "Import | Imports", "globals.terms.export": "Export | Exports", + "globals.terms.test": "Test | Tests", "globals.terms.confirmation": "Confirmation | Confirmations", "globals.terms.dialog": "Dialog | Dialogs", "globals.terms.modal": "Modal | Modals", @@ -229,6 +230,7 @@ "globals.messages.createdSuccessfully": "{name} created successfully", "globals.messages.blockedSuccessfully": "{name} blocked successfully", "globals.messages.unblockedSuccessfully": "{name} unblocked successfully", + "globals.messages.sentSuccessfully": "{name} sent successfully", "globals.messages.pageTooLarge": "Page size is too large, should be at most {max}", "globals.messages.edit": "Edit {name}", "globals.messages.delete": "Delete {name}", @@ -359,6 +361,8 @@ "navigation.away": "Away", "navigation.logout": "Logout", "admin.empty": "Select a section from the sidebar", + "admin.webhook.events.description": "Select the events you want to subscribe to. You can select multiple events.", + "admin.webhook.secret.description": "Optional secret key for webhook signature verification.", "admin.general.siteName": "Site Name", "admin.general.siteName.description": "Name for your support desk.", "admin.general.siteName.min": "Site name should be at least 1 character", @@ -604,4 +608,4 @@ "contact.alreadyExistsWithEmail": "Another contact with same email already exists", "contact.notes.empty": "No notes yet", "contact.notes.help": "Add note for this contact to keep track of important information and conversations." -} +} \ No newline at end of file diff --git a/i18n/mr.json b/i18n/mr.json index a5e010c8..d1428a1f 100644 --- a/i18n/mr.json +++ b/i18n/mr.json @@ -11,6 +11,7 @@ "globals.terms.conversation": "संभाषण | संभाषण", "globals.terms.provider": "प्रदाता | प्रदाते", "globals.terms.state": "राज्य | राज्ये", + "globals.terms.webhook": "वेबहुक | वेबहुक्स", "globals.terms.session": "सत्र | सत्रे", "globals.terms.media": "मीडिया | मीडिया", "globals.terms.permission": "परवानगी | परवानग्या", @@ -44,6 +45,7 @@ "globals.terms.action": "क्रिया | क्रिया", "globals.terms.value": "मूल्य | मूल्ये", "globals.terms.event": "घटना | घटना", + "globals.terms.secret": "गुप्त | गुप्त", "globals.terms.automation": "ऑटोमेशन | ऑटोमेशन", "globals.terms.oidc": "OIDC | OIDC", "globals.terms.oidcProvider": "OIDC प्रदाता | OIDC प्रदाते", @@ -80,6 +82,7 @@ "globals.terms.unassigned": "नियुक्त नसलेले", "globals.terms.pending": "प्रलंबित", "globals.terms.active": "सक्रिय", + "globals.terms.inactive": "निष्क्रिय", "globals.terms.url": "URL | URL", "globals.terms.rootURL": "मूळ URL", "globals.terms.key": "की | की", @@ -135,6 +138,7 @@ "globals.terms.regex": "रेगेक्स | रेगेक्स", "globals.terms.appliesTo": "यांना लागू होते", "globals.terms.createdOn": "यावर तयार केले", + "globals.terms.test": "चाचणी | चाचण्या", "globals.terms.awayReassigning": "दूर आणि पुन्हा नियुक्त करत आहे", "globals.terms.availabilityStatus": "उपलब्धता स्थिती", "globals.terms.lastActive": "शेवटी सक्रिय", @@ -253,6 +257,7 @@ "globals.messages.fileTypeisNotAnImage": "फाइल प्रकार प्रतिमा नाही", "globals.messages.notFound": "{name} सापडले नाही", "globals.messages.empty": "{name} रिकामे", + "globals.messages.sentSuccessfully": "{name} यशस्वीरित्या पाठवले", "globals.messages.mismatch": "{name} जुळत नाही", "globals.messages.errorSendingPasswordResetEmail": "पासवर्ड रीसेट ईमेल पाठवताना त्रुटी", "globals.messages.cannotBeEmpty": "{name} रिकामे असू शकत नाही", @@ -355,6 +360,8 @@ "navigation.away": "दूर", "navigation.logout": "लॉगआउट", "admin.empty": "साइडबारमधून एक विभाग निवडा", + "admin.webhook.events.description": "तुम्ही ज्या घटनांवर सदस्यता घेऊ इच्छिता त्या निवडा. तुम्ही एकाधिक घटना निवडू शकता.", + "admin.webhook.secret.description": "वेबहुक सिग्नेचर पडताळणीसाठी वैकल्पिक गुप्त की.", "admin.general.siteName": "साइट नाव", "admin.general.siteName.description": "तुमच्या सपोर्ट डेस्कचे नाव.", "admin.general.siteName.min": "साइट नाव कमीत कमी 1 अक्षर असावे",