Browse Source

fix: i18n for Multi and single select and its col option

pull/6519/head
Muhammed Mustafa 12 months ago
parent
commit
d4fc26f227
  1. 4
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 4
      packages/nc-gui/components/cell/SingleSelect.vue
  3. 8
      packages/nc-gui/components/smartsheet/column/SelectOptions.vue
  4. 6
      packages/nc-gui/lang/en.json

4
packages/nc-gui/components/cell/MultiSelect.vue

@ -378,7 +378,7 @@ const selectedOpts = computed(() => {
v-model:value="vModel" v-model:value="vModel"
mode="multiple" mode="multiple"
class="w-full overflow-hidden" class="w-full overflow-hidden"
:placeholder="isEditColumn ? '(Optional)' : ''" :placeholder="isEditColumn ? $t('labels.optional') : ''"
:bordered="false" :bordered="false"
clear-icon clear-icon
show-search show-search
@ -421,7 +421,7 @@ const selectedOpts = computed(() => {
<div class="flex gap-2 text-gray-500 items-center h-full"> <div class="flex gap-2 text-gray-500 items-center h-full">
<component :is="iconMap.plusThick" class="min-w-4" /> <component :is="iconMap.plusThick" class="min-w-4" />
<div class="text-xs whitespace-normal"> <div class="text-xs whitespace-normal">
Create new option named <strong>{{ searchVal }}</strong> {{ $t('msg.selectOption.createNewOptionNamed') }} <strong>{{ searchVal }}</strong>
</div> </div>
</div> </div>
</a-select-option> </a-select-option>

4
packages/nc-gui/components/cell/SingleSelect.vue

@ -286,7 +286,7 @@ const selectedOpt = computed(() => {
v-model:value="vModel" v-model:value="vModel"
class="w-full overflow-hidden" class="w-full overflow-hidden"
:class="{ 'caret-transparent': !hasEditRoles }" :class="{ 'caret-transparent': !hasEditRoles }"
:placeholder="isEditColumn ? '(Optional)' : ''" :placeholder="isEditColumn ? $t('labels.optional') : ''"
:allow-clear="!column.rqd && editAllowed" :allow-clear="!column.rqd && editAllowed"
:bordered="false" :bordered="false"
:open="isOpen && editAllowed" :open="isOpen && editAllowed"
@ -324,7 +324,7 @@ const selectedOpt = computed(() => {
<div class="flex gap-2 text-gray-500 items-center h-full"> <div class="flex gap-2 text-gray-500 items-center h-full">
<component :is="iconMap.plusThick" class="min-w-4" /> <component :is="iconMap.plusThick" class="min-w-4" />
<div class="text-xs whitespace-normal"> <div class="text-xs whitespace-normal">
Create new option named <strong>{{ searchVal }}</strong> {{ $t('msg.selectOption.createNewOptionNamed') }} <strong>{{ searchVal }}</strong>
</div> </div>
</div> </div>
</a-select-option> </a-select-option>

8
packages/nc-gui/components/smartsheet/column/SelectOptions.vue

@ -49,6 +49,8 @@ const defaultOption = ref()
const isKanban = inject(IsKanbanInj, ref(false)) const isKanban = inject(IsKanbanInj, ref(false))
const { t } = useI18n()
const validators = { const validators = {
colOptions: [ colOptions: [
{ {
@ -61,13 +63,13 @@ const validators = {
if ((opt as any).status === 'remove') continue if ((opt as any).status === 'remove') continue
if (!opt.title.length) { if (!opt.title.length) {
return reject(new Error("Select options can't be null")) return reject(new Error(t('msg.selectOption.cantBeNull')))
} }
if (vModel.value.uidt === UITypes.MultiSelect && opt.title.includes(',')) { if (vModel.value.uidt === UITypes.MultiSelect && opt.title.includes(',')) {
return reject(new Error("MultiSelect columns can't have commas(',')")) return reject(new Error(t('msg.selectOption.multiSelectCantHaveCommas')))
} }
if (options.value.filter((el) => el.title === opt.title && (el as any).status !== 'remove').length > 1) { if (options.value.filter((el) => el.title === opt.title && (el as any).status !== 'remove').length > 1) {
return reject(new Error("Select options can't have duplicates")) return reject(new Error(t('msg.selectOption.cantHaveDuplicates')))
} }
} }
resolve() resolve()

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

@ -835,6 +835,12 @@
"columnWithTypeFoundButExpected": "Column {columnName} with {columnType} type is found but {expectedType} type is expected", "columnWithTypeFoundButExpected": "Column {columnName} with {columnType} type is found but {expectedType} type is expected",
"columnNotMatchedWithType": "{columnName} is not matched with {columnType}" "columnNotMatchedWithType": "{columnName} is not matched with {columnType}"
}, },
"selectOption": {
"cantBeNull": "Select options can't be null",
"multiSelectCantHaveCommas": "MultiSelect columns can't have commas(',')",
"cantHaveDuplicates": "Select options can't have duplicates",
"createNewOptionNamed": "Create new option named"
},
"plsEnterANumber": "Please enter a number", "plsEnterANumber": "Please enter a number",
"invalidDate": "Invalid date", "invalidDate": "Invalid date",
"invalidLocale": "Invalid locale", "invalidLocale": "Invalid locale",

Loading…
Cancel
Save