Browse Source

fix: i18n for View node, create and duplicate modal

pull/6512/head
Muhammed Mustafa 1 year ago
parent
commit
289fd708db
  1. 7
      packages/nc-gui/components/dashboard/TreeView/ViewsList.vue
  2. 6
      packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue
  3. 29
      packages/nc-gui/components/dlg/ViewCreate.vue
  4. 14
      packages/nc-gui/lang/en.json

7
packages/nc-gui/components/dashboard/TreeView/ViewsList.vue

@ -34,6 +34,7 @@ const table = inject(SidebarTableInj)!
const { isMobileMode } = useGlobal()
const { $e } = useNuxtApp()
const { t } = useI18n()
const isDefaultBase = computed(() => {
const base = project.value?.bases?.find((b) => b.id === table.value.base_id)
@ -84,11 +85,11 @@ function markItem(id: string) {
/** validate view title */
function validate(view: ViewType) {
if (!view.title || view.title.trim().length < 0) {
return 'View name is required'
return t('msg.error.viewNameRequired')
}
if (views.value.some((v) => v.title === view.title && v.id !== view.id)) {
return 'View name should be unique'
return t('msg.error.viewNameDuplicate')
}
return true
@ -357,7 +358,7 @@ function onOpenModal({
'ml-24.75': !isDefaultBase,
}"
>
No Views
{{ $t('labels.noViews') }}
</div>
<a-menu

6
packages/nc-gui/components/dashboard/TreeView/ViewsNode.vue

@ -286,11 +286,11 @@ function onRef(el: HTMLElement) {
<NcMenu class="min-w-27" :data-testid="`view-sidebar-view-actions-${vModel.alias || vModel.title}`">
<NcMenuItem @click.stop="onDblClick">
<GeneralIcon icon="edit" />
<div class="-ml-0.25">Rename</div>
<div class="-ml-0.25">{{ $t('general.rename') }}</div>
</NcMenuItem>
<NcMenuItem @click.stop="onDuplicate">
<GeneralIcon icon="duplicate" class="nc-view-copy-icon" />
Duplicate
{{ $t('general.duplicate') }}
</NcMenuItem>
<NcDivider />
@ -298,7 +298,7 @@ function onRef(el: HTMLElement) {
<template v-if="!vModel.is_default">
<NcMenuItem class="!text-red-500 !hover:bg-red-50" @click.stop="onDelete">
<GeneralIcon icon="delete" class="text-sm nc-view-delete-icon" />
<div class="-ml-0.25">Delete</div>
<div class="-ml-0.25">{{ $t('general.delete') }}</div>
</NcMenuItem>
</template>
</NcMenu>

29
packages/nc-gui/components/dlg/ViewCreate.vue

@ -238,8 +238,21 @@ onMounted(async () => {
<template #header>
<div class="flex flex-row items-center gap-x-1.5">
<GeneralViewIcon :meta="{ type: form.type }" class="nc-view-icon !text-xl" />
{{ $t(`general.${selectedViewId ? 'duplicate' : 'create'}`) }} <span class="capitalize">{{ typeAlias }}</span>
{{ $t('objects.view') }}
<template v-if="form.type === ViewTypes.GRID">
{{ $t('labels.duplicateGridView') }}
</template>
<template v-else-if="form.type === ViewTypes.GALLERY">
{{ $t('labels.duplicateGalleryView') }}
</template>
<template v-else-if="form.type === ViewTypes.FORM">
{{ $t('labels.duplicateFormView') }}
</template>
<template v-else-if="form.type === ViewTypes.KANBAN">
{{ $t('labels.duplicateKanbanView') }}
</template>
<template v-else>
{{ $t('labels.duplicateView') }}
</template>
</div>
</template>
<div class="mt-2">
@ -266,8 +279,8 @@ onMounted(async () => {
:disabled="groupingFieldColumnId || isMetaLoading"
:loading="isMetaLoading"
:options="viewSelectFieldOptions"
placeholder="Select a Grouping Field"
not-found-content="No Single Select Field can be found. Please create one first."
:placeholder="$t('placeholder.selectGroupField')"
:not-found-content="$t('placeholder.selectGroupFieldNotFound')"
/>
</a-form-item>
<a-form-item
@ -282,8 +295,8 @@ onMounted(async () => {
:options="viewSelectFieldOptions"
:disabled="groupingFieldColumnId || isMetaLoading"
:loading="isMetaLoading"
placeholder="Select a GeoData Field"
not-found-content="No GeoData Field can be found. Please create one first."
:placeholder="$t('placeholder.selectGeoField')"
:not-found-content="$t('placeholder.selectGeoFieldNotFound')"
/>
</a-form-item>
</a-form>
@ -294,8 +307,8 @@ onMounted(async () => {
</NcButton>
<NcButton type="primary" :loading="isViewCreating" @click="onSubmit">
Create View
<template #loading> Creating View </template>
{{ $t('labels.createView') }}
<template #loading> {{ $t('labels.creatingView') }}</template>
</NcButton>
</div>
</div>

14
packages/nc-gui/lang/en.json

@ -313,6 +313,14 @@
"profile": "Profile",
"tableName": "Table name",
"dashboardName": "Dashboard name",
"noViews": "No views",
"createView": "Create a View",
"creatingView": "Creating View",
"duplicateView": "Duplicate view",
"duplicateGridView": "Duplicate Grid View",
"duplicateGalleryView": "Duplicate Gallery View",
"duplicateFormView": "Duplicate Form View",
"duplicateKanbanView": "Duplicate Kanban View",
"viewName": "View name",
"viewLink": "View Link",
"columnName": "Column Name",
@ -632,6 +640,10 @@
},
"placeholder": {
"projName": "Enter Project Name",
"selectGroupField": "Select a Grouping Field",
"selectGroupFieldNotFound" : "No Single Select Field can be found. Please create one first.",
"selectGeoField": "Select a GeoData Field",
"selectGeoFieldNotFound": "No GeoData Field can be found. Please create one first.",
"password": {
"enter": "Enter the password",
"current": "Current password",
@ -811,6 +823,8 @@
"noMoreRecords": "No more records"
},
"error": {
"viewNameRequired": "View name is required",
"viewNameUnique": "View name should be unique",
"searchProject": "Your search for {search} found no results",
"invalidChar": "Invalid character in folder path.",
"invalidDbCredentials": "Invalid database credentials.",

Loading…
Cancel
Save