fix: added translation in all listviews

This commit is contained in:
Shariq Ansari 2024-04-15 16:56:47 +05:30
parent 6dcc34ed2c
commit ad51be1445
12 changed files with 103 additions and 85 deletions

View File

@ -172,14 +172,14 @@ function editValues(selections, unselectAll) {
function deleteValues(selections, unselectAll) { function deleteValues(selections, unselectAll) {
$dialog({ $dialog({
title: 'Delete', title: __('Delete'),
message: `Are you sure you want to delete ${selections.size} item${ message: __('Are you sure you want to delete {0} item(s)?', [
selections.size > 1 ? 's' : '' selections.size,
}?`, ]),
variant: 'danger', variant: 'danger',
actions: [ actions: [
{ {
label: 'Delete', label: __('Delete'),
variant: 'solid', variant: 'solid',
theme: 'red', theme: 'red',
onClick: (close) => { onClick: (close) => {
@ -188,7 +188,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'Contact', doctype: 'Contact',
}).then(() => { }).then(() => {
createToast({ createToast({
title: 'Deleted successfully', title: __('Deleted successfully'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -207,11 +207,11 @@ const customListActions = ref([])
function bulkActions(selections, unselectAll) { function bulkActions(selections, unselectAll) {
let actions = [ let actions = [
{ {
label: 'Edit', label: __('Edit'),
onClick: () => editValues(selections, unselectAll), onClick: () => editValues(selections, unselectAll),
}, },
{ {
label: 'Delete', label: __('Delete'),
onClick: () => deleteValues(selections, unselectAll), onClick: () => deleteValues(selections, unselectAll),
}, },
] ]

View File

@ -203,14 +203,12 @@ function editValues(selections, unselectAll) {
function deleteValues(selections, unselectAll) { function deleteValues(selections, unselectAll) {
$dialog({ $dialog({
title: 'Delete', title: __('Delete'),
message: `Are you sure you want to delete ${selections.size} item${ message: __('Are you sure you want to delete {0} item(s)?', [selections.size]),
selections.size > 1 ? 's' : ''
}?`,
variant: 'danger', variant: 'danger',
actions: [ actions: [
{ {
label: 'Delete', label: __('Delete'),
variant: 'solid', variant: 'solid',
theme: 'red', theme: 'red',
onClick: (close) => { onClick: (close) => {
@ -219,7 +217,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'CRM Deal', doctype: 'CRM Deal',
}).then(() => { }).then(() => {
createToast({ createToast({
title: 'Deleted successfully', title: __('Deleted successfully'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -239,17 +237,17 @@ const customListActions = ref([])
function bulkActions(selections, unselectAll) { function bulkActions(selections, unselectAll) {
let actions = [ let actions = [
{ {
label: 'Edit', label: __('Edit'),
onClick: () => editValues(selections, unselectAll), onClick: () => editValues(selections, unselectAll),
}, },
{ {
label: 'Delete', label: __('Delete'),
onClick: () => deleteValues(selections, unselectAll), onClick: () => deleteValues(selections, unselectAll),
}, },
] ]
customBulkActions.value.forEach((action) => { customBulkActions.value.forEach((action) => {
actions.push({ actions.push({
label: action.label, label: __(action.label),
onClick: () => onClick: () =>
action.onClick({ action.onClick({
list: list.value, list: list.value,

View File

@ -154,14 +154,14 @@ function editValues(selections, unselectAll) {
function deleteValues(selections, unselectAll) { function deleteValues(selections, unselectAll) {
$dialog({ $dialog({
title: 'Delete', title: __('Delete'),
message: `Are you sure you want to delete ${selections.size} item${ message: __('Are you sure you want to delete {0} item(s)?', [
selections.size > 1 ? 's' : '' selections.size,
}?`, ]),
variant: 'danger', variant: 'danger',
actions: [ actions: [
{ {
label: 'Delete', label: __('Delete'),
variant: 'solid', variant: 'solid',
theme: 'red', theme: 'red',
onClick: (close) => { onClick: (close) => {
@ -170,7 +170,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'Email Template', doctype: 'Email Template',
}).then(() => { }).then(() => {
createToast({ createToast({
title: 'Deleted successfully', title: __('Deleted successfully'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -189,11 +189,11 @@ const customListActions = ref([])
function bulkActions(selections, unselectAll) { function bulkActions(selections, unselectAll) {
let actions = [ let actions = [
{ {
label: 'Edit', label: __('Edit'),
onClick: () => editValues(selections, unselectAll), onClick: () => editValues(selections, unselectAll),
}, },
{ {
label: 'Delete', label: __('Delete'),
onClick: () => deleteValues(selections, unselectAll), onClick: () => deleteValues(selections, unselectAll),
}, },
] ]

View File

@ -157,14 +157,14 @@ function editValues(selections, unselectAll) {
function deleteValues(selections, unselectAll) { function deleteValues(selections, unselectAll) {
$dialog({ $dialog({
title: 'Delete', title: __('Delete'),
message: `Are you sure you want to delete ${selections.size} item${ message: __('Are you sure you want to delete {0} item(s)?', [
selections.size > 1 ? 's' : '' selections.size,
}?`, ]),
variant: 'danger', variant: 'danger',
actions: [ actions: [
{ {
label: 'Delete', label: __('Delete'),
variant: 'solid', variant: 'solid',
theme: 'red', theme: 'red',
onClick: (close) => { onClick: (close) => {
@ -173,7 +173,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'CRM Organization', doctype: 'CRM Organization',
}).then(() => { }).then(() => {
createToast({ createToast({
title: 'Deleted successfully', title: __('Deleted successfully'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -192,11 +192,11 @@ const customListActions = ref([])
function bulkActions(selections, unselectAll) { function bulkActions(selections, unselectAll) {
let actions = [ let actions = [
{ {
label: 'Edit', label: __('Edit'),
onClick: () => editValues(selections, unselectAll), onClick: () => editValues(selections, unselectAll),
}, },
{ {
label: 'Delete', label: __('Delete'),
onClick: () => deleteValues(selections, unselectAll), onClick: () => deleteValues(selections, unselectAll),
}, },
] ]

View File

@ -176,14 +176,12 @@ function editValues(selections, unselectAll) {
function deleteValues(selections, unselectAll) { function deleteValues(selections, unselectAll) {
$dialog({ $dialog({
title: 'Delete', title: __('Delete'),
message: `Are you sure you want to delete ${selections.size} item${ message: __('Are you sure you want to delete {0} item(s)?'),
selections.size > 1 ? 's' : ''
}?`,
variant: 'danger', variant: 'danger',
actions: [ actions: [
{ {
label: 'Delete', label: __('Delete'),
variant: 'solid', variant: 'solid',
theme: 'red', theme: 'red',
onClick: (close) => { onClick: (close) => {
@ -192,7 +190,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'CRM Task', doctype: 'CRM Task',
}).then(() => { }).then(() => {
createToast({ createToast({
title: 'Deleted successfully', title: __('Deleted successfully'),
icon: 'check', icon: 'check',
iconClasses: 'text-green-600', iconClasses: 'text-green-600',
}) })
@ -211,11 +209,11 @@ const customListActions = ref([])
function bulkActions(selections, unselectAll) { function bulkActions(selections, unselectAll) {
let actions = [ let actions = [
{ {
label: 'Edit', label: __('Edit'),
onClick: () => editValues(selections, unselectAll), onClick: () => editValues(selections, unselectAll),
}, },
{ {
label: 'Delete', label: __('Delete'),
onClick: () => deleteValues(selections, unselectAll), onClick: () => deleteValues(selections, unselectAll),
}, },
] ]

View File

@ -44,7 +44,7 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<PhoneIcon class="h-10 w-10" /> <PhoneIcon class="h-10 w-10" />
<span>No Logs Found</span> <span>{{ __('No Logs Found') }}</span>
</div> </div>
</div> </div>
</template> </template>
@ -69,7 +69,7 @@ import { computed, ref } from 'vue'
const { getUser } = usersStore() const { getUser } = usersStore()
const { getContact, getLeadContact } = contactsStore() const { getContact, getLeadContact } = contactsStore()
const breadcrumbs = [{ label: 'Call Logs', route: { name: 'Call Logs' } }] const breadcrumbs = [{ label: __('Call Logs'), route: { name: 'Call Logs' } }]
const callLogsListView = ref(null) const callLogsListView = ref(null)

View File

@ -8,7 +8,11 @@
v-if="contactsListView?.customListActions" v-if="contactsListView?.customListActions"
:actions="contactsListView.customListActions" :actions="contactsListView.customListActions"
/> />
<Button variant="solid" label="Create" @click="showContactModal = true"> <Button
variant="solid"
:label="__('Create')"
@click="showContactModal = true"
>
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</template> </template>
@ -47,8 +51,8 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<ContactsIcon class="h-10 w-10" /> <ContactsIcon class="h-10 w-10" />
<span>No Contacts Found</span> <span>{{ __('No Contacts Found') }}</span>
<Button label="Create" @click="showContactModal = true"> <Button :label="__('Create')" @click="showContactModal = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</div> </div>
@ -81,10 +85,10 @@ const currentContact = computed(() => {
}) })
const breadcrumbs = computed(() => { const breadcrumbs = computed(() => {
let items = [{ label: 'Contacts', route: { name: 'Contacts' } }] let items = [{ label: __('Contacts'), route: { name: 'Contacts' } }]
if (!currentContact.value) return items if (!currentContact.value) return items
items.push({ items.push({
label: currentContact.value.full_name, label: __(currentContact.value.full_name),
route: { route: {
name: 'Contact', name: 'Contact',
params: { contactId: currentContact.value.name }, params: { contactId: currentContact.value.name },

View File

@ -8,7 +8,11 @@
v-if="dealsListView?.customListActions" v-if="dealsListView?.customListActions"
:actions="dealsListView.customListActions" :actions="dealsListView.customListActions"
/> />
<Button variant="solid" label="Create" @click="showNewDialog = true"> <Button
variant="solid"
:label="__('Create')"
@click="showNewDialog = true"
>
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</template> </template>
@ -44,8 +48,8 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<DealsIcon class="h-10 w-10" /> <DealsIcon class="h-10 w-10" />
<span>No Deals Found</span> <span>{{ __('No Deals Found') }}</span>
<Button label="Create" @click="showNewDialog = true"> <Button :label="__('Create')" @click="showNewDialog = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</div> </div>
@ -54,8 +58,7 @@
v-model="showNewDialog" v-model="showNewDialog"
:options="{ :options="{
size: '3xl', size: '3xl',
title: 'New Deal', title: __('New Deal'),
actions: [{ label: 'Save', variant: 'solid' }],
}" }"
> >
<template #body-content> <template #body-content>
@ -63,7 +66,11 @@
</template> </template>
<template #actions="{ close }"> <template #actions="{ close }">
<div class="flex flex-row-reverse gap-2"> <div class="flex flex-row-reverse gap-2">
<Button variant="solid" label="Save" @click="createNewDeal(close)" /> <Button
variant="solid"
:label="__('Save')"
@click="createNewDeal(close)"
/>
</div> </div>
</template> </template>
</Dialog> </Dialog>
@ -85,12 +92,13 @@ import {
timeAgo, timeAgo,
formatNumberIntoCurrency, formatNumberIntoCurrency,
formatTime, formatTime,
createToast,
} from '@/utils' } from '@/utils'
import { createResource, Breadcrumbs } from 'frappe-ui' import { createResource, Breadcrumbs } from 'frappe-ui'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { ref, computed, reactive } from 'vue' import { ref, computed, reactive } from 'vue'
const breadcrumbs = [{ label: 'Deals', route: { name: 'Deals' } }] const breadcrumbs = [{ label: __('Deals'), route: { name: 'Deals' } }]
const { getUser } = usersStore() const { getUser } = usersStore()
const { getOrganization } = organizationsStore() const { getOrganization } = organizationsStore()
@ -218,7 +226,13 @@ function createNewDeal(close) {
.submit(newDeal, { .submit(newDeal, {
validate() { validate() {
if (!newDeal.first_name) { if (!newDeal.first_name) {
return 'First name is required' createToast({
title: __('Error creating deal'),
text: __('First name is required'),
icon: 'x',
iconClasses: 'text-red-600',
})
return __('First name is required')
} }
}, },
onSuccess(data) { onSuccess(data) {

View File

@ -8,7 +8,11 @@
v-if="emailTemplatesListView?.customListActions" v-if="emailTemplatesListView?.customListActions"
:actions="emailTemplatesListView.customListActions" :actions="emailTemplatesListView.customListActions"
/> />
<Button variant="solid" label="Create" @click="showEmailTemplateModal = true"> <Button
variant="solid"
:label="__('Create')"
@click="showEmailTemplateModal = true"
>
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</template> </template>
@ -48,7 +52,10 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<EmailIcon class="h-10 w-10" /> <EmailIcon class="h-10 w-10" />
<span>No Email Templates Found</span> <span>{{ __('No Email Templates Found') }}</span>
<Button :label="__('Create')" @click="showEmailTemplateModal = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button>
</div> </div>
</div> </div>
<EmailTemplateModal <EmailTemplateModal
@ -70,7 +77,7 @@ import { Breadcrumbs } from 'frappe-ui'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
const breadcrumbs = [ const breadcrumbs = [
{ label: 'Email Templates', route: { name: 'Email Templates' } }, { label: __('Email Templates'), route: { name: 'Email Templates' } },
] ]
const emailTemplatesListView = ref(null) const emailTemplatesListView = ref(null)
@ -103,12 +110,12 @@ const rows = computed(() => {
const showEmailTemplateModal = ref(false) const showEmailTemplateModal = ref(false)
const emailTemplate = ref({ const emailTemplate = ref({
subject: '', subject: '',
response: '', response: '',
name: '', name: '',
enabled: 1, enabled: 1,
owner: '', owner: '',
reference_doctype: 'CRM Deal', reference_doctype: 'CRM Deal',
}) })
function showEmailTemplate(name) { function showEmailTemplate(name) {

View File

@ -4,7 +4,7 @@
<Breadcrumbs :items="breadcrumbs" /> <Breadcrumbs :items="breadcrumbs" />
</template> </template>
<template #right-header> <template #right-header>
<Button variant="solid" label="Create" @click="createNote"> <Button variant="solid" :label="__('Create')" @click="createNote">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</template> </template>
@ -16,7 +16,7 @@
doctype="FCRM Note" doctype="FCRM Note"
:options="{ :options="{
hideColumnsButton: true, hideColumnsButton: true,
defaultViewName: 'Notes View', defaultViewName: __('Notes View'),
}" }"
/> />
<div class="flex-1 overflow-y-auto"> <div class="flex-1 overflow-y-auto">
@ -36,8 +36,8 @@
<Dropdown <Dropdown
:options="[ :options="[
{ {
label: __('Delete'),
icon: 'trash-2', icon: 'trash-2',
label: 'Delete',
onClick: () => deleteNote(note.name), onClick: () => deleteNote(note.name),
}, },
]" ]"
@ -88,8 +88,8 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<NoteIcon class="h-10 w-10" /> <NoteIcon class="h-10 w-10" />
<span>No Notes Found</span> <span>{{ __('No Notes Found') }}</span>
<Button label="Create" @click="createNote"> <Button :label="__('Create')" @click="createNote">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</div> </div>
@ -121,13 +121,7 @@ import { ref, watch } from 'vue'
const { getUser } = usersStore() const { getUser } = usersStore()
const list = { const breadcrumbs = [{ label: __('Notes'), route: { name: 'Notes' } }]
title: 'Notes',
plural_label: 'Notes',
singular_label: 'Note',
}
const breadcrumbs = [{ label: list.title, route: { name: 'Notes' } }]
const showNoteModal = ref(false) const showNoteModal = ref(false)
const currentNote = ref(null) const currentNote = ref(null)

View File

@ -10,7 +10,7 @@
/> />
<Button <Button
variant="solid" variant="solid"
label="Create" :label="__('Create')"
@click="showOrganizationModal = true" @click="showOrganizationModal = true"
> >
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
@ -51,8 +51,8 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<OrganizationsIcon class="h-10 w-10" /> <OrganizationsIcon class="h-10 w-10" />
<span>No Organizations Found</span> <span>{{ __('No Organizations Found') }}</span>
<Button label="Create" @click="showOrganizationModal = true"> <Button :label="__('Create')" @click="showOrganizationModal = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</div> </div>
@ -88,10 +88,10 @@ const currentOrganization = computed(() => {
}) })
const breadcrumbs = computed(() => { const breadcrumbs = computed(() => {
let items = [{ label: 'Organizations', route: { name: 'Organizations' } }] let items = [{ label: __('Organizations'), route: { name: 'Organizations' } }]
if (!currentOrganization.value) return items if (!currentOrganization.value) return items
items.push({ items.push({
label: currentOrganization.value.name, label: __(currentOrganization.value.name),
route: { route: {
name: 'Organization', name: 'Organization',
params: { organizationId: currentOrganization.value.name }, params: { organizationId: currentOrganization.value.name },

View File

@ -8,7 +8,7 @@
v-if="tasksListView?.customListActions" v-if="tasksListView?.customListActions"
:actions="tasksListView.customListActions" :actions="tasksListView.customListActions"
/> />
<Button variant="solid" label="Create" @click="createTask"> <Button variant="solid" :label="__('Create')" @click="createTask">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template> <template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button> </Button>
</template> </template>
@ -45,7 +45,10 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500" class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
> >
<EmailIcon class="h-10 w-10" /> <EmailIcon class="h-10 w-10" />
<span>No Tasks Found</span> <span>{{ __('No Tasks Found') }}</span>
<Button :label="__('Create')" @click="showTaskModal = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button>
</div> </div>
</div> </div>
<TaskModal v-model="showTaskModal" v-model:reloadTasks="tasks" :task="task" /> <TaskModal v-model="showTaskModal" v-model:reloadTasks="tasks" :task="task" />
@ -63,7 +66,7 @@ import { dateFormat, dateTooltipFormat, timeAgo } from '@/utils'
import { Breadcrumbs } from 'frappe-ui' import { Breadcrumbs } from 'frappe-ui'
import { computed, ref } from 'vue' import { computed, ref } from 'vue'
const breadcrumbs = [{ label: 'Tasks', route: { name: 'Tasks' } }] const breadcrumbs = [{ label: __('Tasks'), route: { name: 'Tasks' } }]
const { getUser } = usersStore() const { getUser } = usersStore()