Browse Source

fix(nc-gui): i18n for aettings and page

pull/6614/head
reenphygeorge 1 year ago
parent
commit
9bd231bf40
  1. 4
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  2. 31
      packages/nc-gui/components/workspace/Settings.vue
  3. 15
      packages/nc-gui/lang/en.json
  4. 5
      packages/nc-gui/pages/index/[typeOrId]/form/[viewId].vue
  5. 7
      packages/nc-gui/pages/reset/[id].vue

4
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -346,7 +346,7 @@ useActiveKeyupListener(
await Modal.confirm({ await Modal.confirm({
title: t('msg.saveChanges'), title: t('msg.saveChanges'),
okText: t('general.save'), okText: t('general.save'),
cancelText: t('label.discard'), cancelText: t('labels.discard'),
onOk: async () => { onOk: async () => {
await save() await save()
reloadHook?.trigger(null) reloadHook?.trigger(null)
@ -360,7 +360,7 @@ useActiveKeyupListener(
await Modal.confirm({ await Modal.confirm({
title: 'Do you want to save the record?', title: 'Do you want to save the record?',
okText: t('general.save'), okText: t('general.save'),
cancelText: t('label.discard'), cancelText: t('labels.discard'),
onOk: async () => { onOk: async () => {
const data = await _save(rowState.value) const data = await _save(rowState.value)
await syncLTARRefs(data) await syncLTARRefs(data)

31
packages/nc-gui/components/workspace/Settings.vue

@ -1,5 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useI18n } from '#imports'
const { signOut } = useGlobal() const { signOut } = useGlobal()
const { t } = useI18n()
const { deleteWorkspace, navigateToWorkspace, updateWorkspace } = useWorkspace() const { deleteWorkspace, navigateToWorkspace, updateWorkspace } = useWorkspace()
const { workspacesList, activeWorkspaceId, activeWorkspace, workspaces } = storeToRefs(useWorkspace()) const { workspacesList, activeWorkspaceId, activeWorkspace, workspaces } = storeToRefs(useWorkspace())
@ -17,9 +20,9 @@ const form = ref({
const formRules = { const formRules = {
title: [ title: [
{ required: true, message: 'Workspace name required' }, { required: true, message: t('msg.wsNameRequired') },
{ min: 3, message: 'Workspace name must be at least 3 characters long' }, { min: 3, message: t('msg.wsNameMinLength') },
{ max: 50, message: 'Workspace name must be at most 50 characters long' }, { max: 50, message: t('msg.wsNameMaxLength') },
], ],
} }
@ -104,9 +107,9 @@ const onCancel = () => {
<template> <template>
<div class="flex flex-col items-center nc-workspace-settings-settings"> <div class="flex flex-col items-center nc-workspace-settings-settings">
<div class="item flex flex-col w-full"> <div class="item flex flex-col w-full">
<div class="font-medium text-base">Change Workspace Name</div> <div class="font-medium text-base">{{ $t('labels.changeWsName') }}</div>
<a-form ref="formValidator" layout="vertical" no-style :model="form" class="w-full" @finish="titleChange"> <a-form ref="formValidator" layout="vertical" no-style :model="form" class="w-full" @finish="titleChange">
<div class="text-gray-500 mt-6 mb-1.5">Workspace name</div> <div class="text-gray-500 mt-6 mb-1.5">{{ $t('objects.workspace') $t('general.name')}}</div>
<a-form-item name="title" :rules="formRules.title"> <a-form-item name="title" :rules="formRules.title">
<a-input <a-input
v-model:value="form.title" v-model:value="form.title"
@ -123,8 +126,8 @@ const onCancel = () => {
data-testid="nc-workspace-settings-settings-rename-cancel" data-testid="nc-workspace-settings-settings-rename-cancel"
@click="onCancel" @click="onCancel"
> >
<template #loading> Renaming Workspace </template> <template #loading> {{ $t('title.renamingWs') }} </template>
Cancel {{ $t('general.cancel') }}
</NcButton> </NcButton>
<NcButton <NcButton
v-e="['c:workspace:settings:rename']" v-e="['c:workspace:settings:rename']"
@ -134,18 +137,18 @@ const onCancel = () => {
:loading="isDeleting" :loading="isDeleting"
data-testid="nc-workspace-settings-settings-rename-submit" data-testid="nc-workspace-settings-settings-rename-submit"
> >
<template #loading> Renaming Workspace </template> <template #loading> {{ $t('title.renamingWs') }} </template>
Rename Workspace {{ $t('title.renameWs') }}
</NcButton> </NcButton>
</div> </div>
</a-form> </a-form>
</div> </div>
<div class="item flex flex-col"> <div class="item flex flex-col">
<div class="font-medium text-base">Delete Workspace</div> <div class="font-medium text-base">{{ $t('title.deleteWs') }}</div>
<div class="text-gray-500 mt-2">Delete this workspace and all its contents.</div> <div class="text-gray-500 mt-2">{{ $t('msg.wsDeleteDlg') }}</div>
<div class="flex flex-row mt-8 gap-x-2"> <div class="flex flex-row mt-8 gap-x-2">
<a-checkbox v-model:checked="isConfirmed" /> <a-checkbox v-model:checked="isConfirmed" />
<div class="flex">I understand that this action is irreversible</div> <div class="flex">{{ $t('msg.userConfirmation') }}</div>
</div> </div>
<div class="flex flex-row w-full justify-end mt-8"> <div class="flex flex-row w-full justify-end mt-8">
@ -156,8 +159,8 @@ const onCancel = () => {
:loading="isDeleting" :loading="isDeleting"
@click="onDelete" @click="onDelete"
> >
<template #loading> Deleting Workspace </template> <template #loading> {{ $t('title.deletingWs') }} </template>
Delete Workspace {{ $t('title.deleteWs') }}
</NcButton> </NcButton>
</div> </div>
</div> </div>

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

@ -319,6 +319,10 @@
"downloadFile": "Download File", "downloadFile": "Download File",
"renameTable": "Rename Table", "renameTable": "Rename Table",
"renamingTable": "Renaming Table", "renamingTable": "Renaming Table",
"renamingWs": "Renaming Workspace",
"renameWs": "Rename Workspace",
"deleteWs": "Delete Workspace",
"deletingWs": "Deleting Workspace",
"copyAuthToken": "Copy Auth Token", "copyAuthToken": "Copy Auth Token",
"copiedAuthToken": "Copied Auth Token", "copiedAuthToken": "Copied Auth Token",
"copyInviteToken": "Copy Invite Token", "copyInviteToken": "Copy Invite Token",
@ -598,7 +602,8 @@
"zoomInToViewColumns": "Zoom in to view columns", "zoomInToViewColumns": "Zoom in to view columns",
"embedInSite": "Embed this view in your site", "embedInSite": "Embed this view in your site",
"titleRequired": "title is required.", "titleRequired": "title is required.",
"sourceNameRequired":"Source name is required" "sourceNameRequired":"Source name is required",
"changeWsName":"Change Workspace Name",
}, },
"activity": { "activity": {
"onCondition": "On Condition", "onCondition": "On Condition",
@ -1141,7 +1146,13 @@
"noMoreRecords": "No more records", "noMoreRecords": "No more records",
"tokenNameNotEmpty": "Token name should not be empty", "tokenNameNotEmpty": "Token name should not be empty",
"tokenNameMaxLength": "Token name should not be more than 255 characters", "tokenNameMaxLength": "Token name should not be more than 255 characters",
"dbNamerequired": "Database name is required" "dbNamerequired": "Database name is required",
"wsNameRequired":"Workspace name required",
"wsNameMinLength":"Workspace name must be at least 3 characters long",
"wsNameMaxLength":"Workspace name must be at most 50 characters long",
"wsDeleteDlg": "Delete this workspace and all it’s contents.",
"userConfirmation": "I understand that this action is irreversible",
"pageNotFound":"Page Not Found"
}, },
"error": { "error": {
"nameRequired": "Name Required", "nameRequired": "Name Required",

5
packages/nc-gui/pages/index/[typeOrId]/form/[viewId].vue

@ -17,6 +17,7 @@ import {
useRoute, useRoute,
useSidebar, useSidebar,
watch, watch,
useI18n
} from '#imports' } from '#imports'
definePageMeta({ definePageMeta({
@ -27,6 +28,8 @@ useSidebar('nc-left-sidebar', { hasSidebar: false })
const route = useRoute() const route = useRoute()
const { t } = useI18n()
const { loadSharedView, sharedView, sharedViewMeta, meta, notFound, password, passwordDlg, passwordError } = const { loadSharedView, sharedView, sharedViewMeta, meta, notFound, password, passwordDlg, passwordError } =
useProvideSharedFormStore(route.params.viewId as string) useProvideSharedFormStore(route.params.viewId as string)
@ -43,7 +46,7 @@ if (!notFound.value) {
applyLanguageDirection(sharedViewMeta.value.rtl ? 'rtl' : 'ltr') applyLanguageDirection(sharedViewMeta.value.rtl ? 'rtl' : 'ltr')
} else { } else {
navigateTo('/error/404') navigateTo('/error/404')
throw createError({ statusCode: 404, statusMessage: 'Page Not Found' }) throw createError({ statusCode: 404, statusMessage: t('msg.pageNotFound') })
} }
const form = reactive({ const form = reactive({

7
packages/nc-gui/pages/reset/[id].vue

@ -10,6 +10,7 @@ import {
useApi, useApi,
useRoute, useRoute,
useRouter, useRouter,
useI18n
} from '#imports' } from '#imports'
definePageMeta({ definePageMeta({
@ -18,6 +19,8 @@ definePageMeta({
const { api, isLoading, error } = useApi() const { api, isLoading, error } = useApi()
const { t } = useI18n()
const route = useRoute() const route = useRoute()
const navigator = useRouter() const navigator = useRouter()
@ -88,7 +91,7 @@ function resetError() {
<a-form-item <a-form-item
:label="$t('placeholder.password.new')" :label="$t('placeholder.password.new')"
name="password" name="password"
:rules="[{ required: true, message: 'password is required' }]" :rules="[{ required: true, message: t('error.passwdRequired') }]"
> >
<a-input-password <a-input-password
v-model:value="form.password" v-model:value="form.password"
@ -101,7 +104,7 @@ function resetError() {
<a-form-item <a-form-item
:label="$t('placeholder.password.confirm')" :label="$t('placeholder.password.confirm')"
name="newPassword" name="newPassword"
:rules="[{ required: true, message: 'password is required' }]" :rules="[{ required: true, message: t('error.passwdRequired') }]"
> >
<a-input-password <a-input-password
v-model:value="form.newPassword" v-model:value="form.newPassword"

Loading…
Cancel
Save