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) {
$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) => {
@ -188,7 +188,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'Contact',
}).then(() => {
createToast({
title: 'Deleted successfully',
title: __('Deleted successfully'),
icon: 'check',
iconClasses: 'text-green-600',
})
@ -207,11 +207,11 @@ 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),
},
]

View File

@ -203,14 +203,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) => {
@ -219,7 +217,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'CRM Deal',
}).then(() => {
createToast({
title: 'Deleted successfully',
title: __('Deleted successfully'),
icon: 'check',
iconClasses: 'text-green-600',
})
@ -239,17 +237,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,

View File

@ -154,14 +154,14 @@ 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) => {
@ -170,7 +170,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'Email Template',
}).then(() => {
createToast({
title: 'Deleted successfully',
title: __('Deleted successfully'),
icon: 'check',
iconClasses: 'text-green-600',
})
@ -189,11 +189,11 @@ 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),
},
]

View File

@ -157,14 +157,14 @@ 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) => {
@ -173,7 +173,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'CRM Organization',
}).then(() => {
createToast({
title: 'Deleted successfully',
title: __('Deleted successfully'),
icon: 'check',
iconClasses: 'text-green-600',
})
@ -192,11 +192,11 @@ 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),
},
]

View File

@ -176,14 +176,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)?'),
variant: 'danger',
actions: [
{
label: 'Delete',
label: __('Delete'),
variant: 'solid',
theme: 'red',
onClick: (close) => {
@ -192,7 +190,7 @@ function deleteValues(selections, unselectAll) {
doctype: 'CRM Task',
}).then(() => {
createToast({
title: 'Deleted successfully',
title: __('Deleted successfully'),
icon: 'check',
iconClasses: 'text-green-600',
})
@ -211,11 +209,11 @@ 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),
},
]

View File

@ -44,7 +44,7 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
>
<PhoneIcon class="h-10 w-10" />
<span>No Logs Found</span>
<span>{{ __('No Logs Found') }}</span>
</div>
</div>
</template>
@ -69,7 +69,7 @@ import { computed, ref } from 'vue'
const { getUser } = usersStore()
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)

View File

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

View File

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

View File

@ -8,7 +8,11 @@
v-if="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>
</Button>
</template>
@ -48,7 +52,10 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
>
<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>
<EmailTemplateModal
@ -70,7 +77,7 @@ import { Breadcrumbs } from 'frappe-ui'
import { computed, ref } from 'vue'
const breadcrumbs = [
{ label: 'Email Templates', route: { name: 'Email Templates' } },
{ label: __('Email Templates'), route: { name: 'Email Templates' } },
]
const emailTemplatesListView = ref(null)
@ -103,12 +110,12 @@ const rows = computed(() => {
const showEmailTemplateModal = ref(false)
const emailTemplate = ref({
subject: '',
response: '',
name: '',
enabled: 1,
owner: '',
reference_doctype: 'CRM Deal',
subject: '',
response: '',
name: '',
enabled: 1,
owner: '',
reference_doctype: 'CRM Deal',
})
function showEmailTemplate(name) {

View File

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

View File

@ -10,7 +10,7 @@
/>
<Button
variant="solid"
label="Create"
:label="__('Create')"
@click="showOrganizationModal = true"
>
<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"
>
<OrganizationsIcon class="h-10 w-10" />
<span>No Organizations Found</span>
<Button label="Create" @click="showOrganizationModal = true">
<span>{{ __('No Organizations Found') }}</span>
<Button :label="__('Create')" @click="showOrganizationModal = true">
<template #prefix><FeatherIcon name="plus" class="h-4" /></template>
</Button>
</div>
@ -88,10 +88,10 @@ const currentOrganization = computed(() => {
})
const breadcrumbs = computed(() => {
let items = [{ label: 'Organizations', route: { name: 'Organizations' } }]
let items = [{ label: __('Organizations'), route: { name: 'Organizations' } }]
if (!currentOrganization.value) return items
items.push({
label: currentOrganization.value.name,
label: __(currentOrganization.value.name),
route: {
name: 'Organization',
params: { organizationId: currentOrganization.value.name },

View File

@ -8,7 +8,7 @@
v-if="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>
</Button>
</template>
@ -45,7 +45,10 @@
class="flex flex-col items-center gap-3 text-xl font-medium text-gray-500"
>
<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>
<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 { computed, ref } from 'vue'
const breadcrumbs = [{ label: 'Tasks', route: { name: 'Tasks' } }]
const breadcrumbs = [{ label: __('Tasks'), route: { name: 'Tasks' } }]
const { getUser } = usersStore()