From 6dcc34ed2c6f55a9c21d441ce3a03d6447f4fe21 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Mon, 15 Apr 2024 16:34:31 +0530 Subject: [PATCH] fix: added translation in Leads Listview --- .../components/ListViews/LeadsListView.vue | 16 ++++---- frontend/src/pages/Leads.vue | 37 ++++++++++++++----- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/frontend/src/components/ListViews/LeadsListView.vue b/frontend/src/components/ListViews/LeadsListView.vue index a78a62ec..bf7c83ad 100644 --- a/frontend/src/components/ListViews/LeadsListView.vue +++ b/frontend/src/components/ListViews/LeadsListView.vue @@ -212,14 +212,12 @@ function editValues(selections, unselectAll) { function deleteValues(selections, unselectAll) { $dialog({ - title: 'Delete', - message: `Are you sure you want to delete ${selections.size} item${ - selections.size > 1 ? 's' : '' - }?`, + title: __('Delete'), + message: __('Are you sure you want to delete {0} item(s)?', [selections.size]), variant: 'danger', actions: [ { - label: 'Delete', + label: __('Delete'), variant: 'solid', theme: 'red', onClick: (close) => { @@ -228,7 +226,7 @@ function deleteValues(selections, unselectAll) { doctype: 'CRM Lead', }).then(() => { createToast({ - title: 'Deleted successfully', + title: __('Deleted successfully'), icon: 'check', iconClasses: 'text-green-600', }) @@ -248,17 +246,17 @@ const customListActions = ref([]) function bulkActions(selections, unselectAll) { let actions = [ { - label: 'Edit', + label: __('Edit'), onClick: () => editValues(selections, unselectAll), }, { - label: 'Delete', + label: __('Delete'), onClick: () => deleteValues(selections, unselectAll), }, ] customBulkActions.value.forEach((action) => { actions.push({ - label: action.label, + label: __(action.label), onClick: () => action.onClick({ list: list.value, diff --git a/frontend/src/pages/Leads.vue b/frontend/src/pages/Leads.vue index 5e018865..905b8f2f 100644 --- a/frontend/src/pages/Leads.vue +++ b/frontend/src/pages/Leads.vue @@ -8,7 +8,11 @@ v-if="leadsListView?.customListActions" :actions="leadsListView.customListActions" /> - @@ -45,8 +49,8 @@ class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" > - No Leads Found - @@ -55,8 +59,7 @@ v-model="showNewDialog" :options="{ size: '3xl', - title: 'New Lead', - actions: [{ label: 'Save', variant: 'solid' }], + title: __('New Lead'), }" > @@ -80,12 +87,18 @@ import ViewControls from '@/components/ViewControls.vue' import { usersStore } from '@/stores/users' import { organizationsStore } from '@/stores/organizations' import { statusesStore } from '@/stores/statuses' -import { dateFormat, dateTooltipFormat, timeAgo, formatTime } from '@/utils' +import { + dateFormat, + dateTooltipFormat, + timeAgo, + formatTime, + createToast, +} from '@/utils' import { createResource, Breadcrumbs } from 'frappe-ui' import { useRouter } from 'vue-router' import { ref, computed, reactive } from 'vue' -const breadcrumbs = [{ label: 'Leads', route: { name: 'Leads' } }] +const breadcrumbs = [{ label: __('Leads'), route: { name: 'Leads' } }] const { getUser } = usersStore() const { getOrganization } = organizationsStore() @@ -219,7 +232,13 @@ function createNewLead(close) { .submit(newLead, { validate() { if (!newLead.first_name) { - return 'First name is required' + createToast({ + title: __('Error creating lead'), + text: __('First name is required'), + icon: 'x', + iconClasses: 'text-red-600', + }) + return __('First name is required') } }, onSuccess(data) {