Browse Source

fix(nc-gui): fix i18n for surveys and dlgs

pull/6614/head
reenphygeorge 1 year ago
parent
commit
4a5d1c29ec
  1. 12
      packages/nc-gui/components/workspace/InviteCollabDlg.vue
  2. 3
      packages/nc-gui/components/workspace/MoveProjectDlg.vue
  3. 17
      packages/nc-gui/lang/en.json
  4. 6
      packages/nc-gui/layouts/base.vue
  5. 6
      packages/nc-gui/layouts/new.vue
  6. 3
      packages/nc-gui/pages/index/[typeOrId]/form/[viewId].vue
  7. 23
      packages/nc-gui/pages/index/[typeOrId]/form/[viewId]/index/survey.vue

12
packages/nc-gui/components/workspace/InviteCollabDlg.vue

@ -42,12 +42,18 @@ const validators = computed(() => {
{
validator: (rule: any, value: string, callback: (errMsg?: string) => void) => {
if (!value || value.length === 0) {
callback('Email is required')
callback(t('error.signUpRules.emailReqd'))
return
}
const invalidEmails = (value || '').split(/\s*,\s*/).filter((e: string) => !validateEmail(e))
if (invalidEmails.length > 0) {
callback(`${invalidEmails.length > 1 ? ' Invalid emails:' : 'Invalid email:'} ${invalidEmails.join(', ')} `)
callback(
`${
invalidEmails.length > 1
? `${t('error.signUpRules.invalidEmails')}: `
: `${t('error.signUpRules.invalidEmails')}: `
} ${invalidEmails.join(', ')} `,
)
} else {
callback()
}
@ -119,8 +125,6 @@ const emailInput = ref((el) => {
wrap-class-name="nc-modal-invite-user"
@cancel="emit('closed')"
>
<!-- TODO: i18n -->
<div class="flex flex-col">
<div class="flex flex-row justify-between items-center pb-1.5 mb-2 border-b-1 w-full">
<a-typography-title class="select-none" :level="4"> {{ $t('activity.inviteUser') }}</a-typography-title>

3
packages/nc-gui/components/workspace/MoveProjectDlg.vue

@ -55,8 +55,7 @@ const ownedWorkspaces = computed(() => {
<!-- Create A New Table -->
<div class="prose-xl font-bold self-center my-4">{{ $t('activity.moveProject') }}</div>
<!-- todo: i18n -->
<div class="mb-2">Workspace</div>
<div class="mb-2">{{ $t('objects.workspace') }}</div>
<a-select v-model:value="workspaceId" class="w-full" show-search>
<a-select-option v-for="workspace of ownedWorkspaces" :key="workspace.id" :value="workspace.id">
{{ workspace.title }}

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

@ -179,7 +179,10 @@
"join": "Join",
"options": "Options",
"primaryValue": "Primary Value",
"useSurveyMode": "Use Survey Mode"
"useSurveyMode": "Use Survey Mode",
"shift": "Shift",
"enter": "Enter",
"seconds": "Seconds"
},
"objects": {
"workspace": "Workspace",
@ -602,8 +605,10 @@
"zoomInToViewColumns": "Zoom in to view columns",
"embedInSite": "Embed this view in your site",
"titleRequired": "title is required.",
"sourceNameRequired":"Source name is required",
"changeWsName":"Change Workspace Name"
"sourceNameRequired": "Source name is required",
"changeWsName": "Change Workspace Name",
"pressEnter": "Press Enter",
"newFormLoaded": "New form will be loaded after"
},
"activity": {
"onCondition": "On Condition",
@ -1152,7 +1157,11 @@
"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"
"pageNotFound":"Page Not Found",
"makeLineBreak":"to make a line break",
"goToNext": "Go to next",
"thankyou":"Thank you!",
"submittedFormData": "You have successfully submitted the form data."
},
"error": {
"nameRequired": "Name Required",

6
packages/nc-gui/layouts/base.vue

@ -69,7 +69,7 @@ hooks.hook('page:finish', () => {
<LazyGeneralReleaseInfo />
<a-tooltip v-if="!appInfo.ee" placement="bottom" :mouse-enter-delay="1">
<template #title> Switch language</template>
<template #title>{{ $t('title.switchLanguage') }}</template>
<div class="flex pr-4 items-center">
<LazyGeneralLanguage class="cursor-pointer text-2xl hover:text-accent" />
@ -106,7 +106,7 @@ hooks.hook('page:finish', () => {
>
<MdiShieldAccountOutline class="mt-1 group-hover:text-accent" />&nbsp;
&lt;!&ndash; todo: i18n &ndash;&gt;
&lt;!&ndash; &ndash;&gt;
<span class="prose group-hover:text-primary">Account management</span>
</nuxt-link>
</a-menu-item>
@ -129,7 +129,7 @@ hooks.hook('page:finish', () => {
</a-layout-header>
<a-tooltip v-if="!appInfo.ee" placement="bottom">
<template #title> Switch language</template>
<template #title>{{ $t('title.switchLanguage') }}</template>
<LazyGeneralLanguage v-if="!signedIn && !route.params.baseId && !route.params.erdUuid" class="nc-lang-btn" />
</a-tooltip>

6
packages/nc-gui/layouts/new.vue

@ -58,7 +58,7 @@ export default {
<div v-if="$route.name === 'index-index'" class="flex gap-1">
<!-- <a-button class="!text-inherit" data-testid="nc-dash-nav-workspaces"> Projects</a-button -->
<!-- <a-button ghost class="!text-inherit" data-testid="nc-dash-nav-explore"> Template</a-button>
<!-- <a-button ghost !text-inherit" data-testid="nc-dash-nav-explore"> Template</a-button>
<a-button ghost class="!text-inherit" data-testid="nc-dash-nav-help"> Help</a-button> -->
</div>
<div class="flex-1 min-w-0 flex justify-end gap-2">
@ -92,7 +92,7 @@ export default {
<nuxt-link v-e="['c:navbar:user:email']" class="nc-base-menu-item group !no-underline" to="/account/users">
<MdiAccountCircleOutline class="mt-1 group-hover:text-accent" />&nbsp;
<div class="prose group-hover:text-primary">
<div>Account</div>
<div>{{ $t('labels.account') }}</div>
<div class="text-xs text-gray-500">{{ email }}</div>
</div>
</nuxt-link>
@ -107,7 +107,7 @@ export default {
>
<MdiShieldAccountOutline class="mt-1 group-hover:text-accent" />&nbsp;
&lt;!&ndash; todo: i18n &ndash;&gt;
&lt;!&ndash; &ndash;&gt;
<span class="prose group-hover:text-primary">Account management</span>
</nuxt-link>
</a-menu-item>

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

@ -12,12 +12,12 @@ import {
provide,
reactive,
ref,
useI18n,
useProvideSharedFormStore,
useProvideSmartsheetStore,
useRoute,
useSidebar,
watch,
useI18n
} from '#imports'
definePageMeta({
@ -77,7 +77,6 @@ watch(
@close="passwordDlg = false"
>
<div class="w-full flex flex-col gap-4">
<!-- todo: i18n -->
<h2 class="text-xl font-semibold">{{ $t('msg.thisSharedViewIsProtected') }}</h2>
<a-form layout="vertical" no-style :model="form" @finish="loadSharedView">

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

@ -318,8 +318,8 @@ onMounted(() => {
</div>
<div v-if="field.uidt === UITypes.LongText" class="text-sm text-gray-500 flex flex-wrap items-center">
Shift <MdiAppleKeyboardShift class="mx-1 text-primary" /> + Enter
<MaterialSymbolsKeyboardReturn class="mx-1 text-primary" /> to make a line break
{{ $t('general.shift') }} <MdiAppleKeyboardShift class="mx-1 text-primary" /> + {{ $t('general.enter') }}
<MaterialSymbolsKeyboardReturn class="mx-1 text-primary" /> {{ $t('msg.makeLineBreak') }}
</div>
</div>
</LazySmartsheetDivDataCell>
@ -345,7 +345,9 @@ onMounted(() => {
<div v-else-if="!submitted" class="flex items-center gap-3 flex-col">
<a-tooltip
:title="v$.localState[field.title]?.$error ? v$.localState[field.title].$errors[0].$message : 'Go to next'"
:title="
v$.localState[field.title]?.$error ? v$.localState[field.title].$errors[0].$message : $t('msg.goToNext')
"
:mouse-enter-delay="0.25"
:mouse-leave-delay="0"
>
@ -361,7 +363,7 @@ onMounted(() => {
@click="goNext()"
>
<Transition name="fade">
<span v-if="!v$.localState[field.title]?.$error" class="uppercase text-white">Ok</span>
<span v-if="!v$.localState[field.title]?.$error" class="uppercase text-white">{{ $t('general.ok') }}</span>
</Transition>
<Transition name="slide-right" mode="out-in">
@ -375,9 +377,8 @@ onMounted(() => {
</NcButton>
</a-tooltip>
<!-- todo: i18n -->
<div class="hidden md:flex text-sm text-gray-500 items-center gap-1">
Press Enter <MaterialSymbolsKeyboardReturn class="text-primary" />
{{ $t('labels.pressEnter') }} <MaterialSymbolsKeyboardReturn class="text-primary" />
</div>
</div>
</div>
@ -392,21 +393,21 @@ onMounted(() => {
<template v-else>
<div class="flex flex-col gap-1">
<div>Thank you!</div>
<div>{{ $t('msg.thankyou') }}</div>
<div>You have successfully submitted the form data.</div>
<div>{{ $t('msg.submittedFormData') }}</div>
</div>
</template>
</div>
<div v-if="sharedFormView" class="mt-3">
<p v-if="sharedFormView?.show_blank_form" class="text-xs text-slate-500 dark:text-slate-300 text-center my-4">
New form will be loaded after {{ secondsRemain }} seconds
{{ $t('labels.newFormLoaded') }} {{ secondsRemain }} {{ $t('general.seconds') }}
</p>
<div v-if="sharedFormView?.submit_another_form" class="text-center">
<NcButton type="primary" data-testid="nc-survey-form__btn-submit-another-form" @click="resetForm">
Submit Another Form
{{ $t('activity.submitAnotherForm') }}
</NcButton>
</div>
</div>
@ -448,7 +449,7 @@ onMounted(() => {
</a-tooltip>
<a-tooltip
:title="v$.localState[field.title]?.$error ? '' : 'Go to next'"
:title="v$.localState[field.title]?.$error ? '' : $t('msg.goToNext')"
:mouse-enter-delay="0.25"
:mouse-leave-delay="0"
>

Loading…
Cancel
Save