From 5499d85755ead6a97a068a18400e5482ecd4692e Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Thu, 11 Jan 2024 12:39:54 +0000 Subject: [PATCH] fix(nc-gui): use i18n translation in multified editor --- .../components/smartsheet/details/Fields.vue | 57 ++++++++++--------- packages/nc-gui/lang/en.json | 30 ++++++++-- 2 files changed, 56 insertions(+), 31 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/details/Fields.vue b/packages/nc-gui/components/smartsheet/details/Fields.vue index 87182660f8..12a05b2a98 100644 --- a/packages/nc-gui/components/smartsheet/details/Fields.vue +++ b/packages/nc-gui/components/smartsheet/details/Fields.vue @@ -33,6 +33,7 @@ interface moveOp { index: number order: number } +const { t } = useI18n() const { $api } = useNuxtApp() @@ -228,7 +229,7 @@ const duplicateField = async (field: TableExplorerColumn) => { case UITypes.Lookup: case UITypes.Rollup: case UITypes.Formula: - return message.info('Not available at the moment') + return message.info(t('msg.info.notAvailableAtTheMoment')) case UITypes.SingleSelect: case UITypes.MultiSelect: fieldPayload = { @@ -270,7 +271,7 @@ const onFieldUpdate = (state: TableExplorerColumn) => { const col = fields.value.find((col) => compareCols(col, state)) if (!col) return - const diffs = diff(col, state) + const diffs = diff(col, state) as Partial // hack to prevent update status `Updated Field` when clicking on field first time let isUpdated = true @@ -389,13 +390,13 @@ const onMove = (_event: { moved: { newIndex: number; oldIndex: number } }) => { if (op?.op === 'update') { const diffs = diff(op.column, field) if (!(Object.keys(diffs).length === 1 && 'column_order' in diffs)) { - message.warning('You cannot move field that is being edited. Either save or discard changes first') + message.warning(t('msg.warning.multiField.moveEditedField')) return } } if (op?.op === 'delete') { - message.warning('You cannot move field that is deleted. Either save or discard changes first') + message.warning(t('msg.warning.multiField.moveDeletedField')) return } @@ -563,7 +564,7 @@ const isColumnsValid = computed(() => fields.value.every((f) => isColumnValid(f) const saveChanges = async () => { if (!isColumnsValid.value) { - message.error('Please complete the configuration of all fields before saving') + message.error(t('msg.error.multiFieldSaveValidation')) return } else if (!loading.value && ops.value.length < 1 && moveOps.value.length < 1 && visibilityOps.value.length < 1) { return @@ -640,7 +641,7 @@ const saveChanges = async () => { visibilityOps.value = [] } catch (e) { - message.error('Something went wrong') + message.error(t('msg.error.somethingWentWrong')) } finally { loading.value = false } @@ -648,7 +649,7 @@ const saveChanges = async () => { const toggleVisibility = async (checked: boolean, field: Field) => { if (field.fk_column_id && fieldStatuses.value[field.fk_column_id]) { - message.warning('You cannot change visibility of a field that is being edited. Please save or discard changes first.') + message.warning(t('msg.warning.multiField.fieldVisibility')) return } if (visibilityOps.value.find((op) => op.column.fk_column_id === field.fk_column_id)) { @@ -742,7 +743,7 @@ onKeyDown('Backspace', () => { onKeyDown('ArrowRight', () => { if (document.activeElement?.tagName === 'TEXTAREA') return if (activeField.value) { - const input = document.querySelector('.nc-fields-input') + const input = document.querySelector('.nc-fields-input') as HTMLInputElement if (input) { input.focus() } @@ -821,7 +822,7 @@ watch( data-testid="nc-field-search-input" v-model:value="searchQuery" class="!h-8 !px-1 !rounded-lg !w-72" - placeholder="Search field" + :placeholder="$t('placeholder.searchFields')" > @@ -1147,7 +1152,7 @@ watch( class="bg-red-50 text-red-700" data-testid="nc-field-status-deleted-field" > - Deleted field + {{ $t('labels.multiField.deletedField') }} - Updated field + {{ $t('labels.multiField.updatedField') }}
- Restore + {{ $t('general.restore') }}
-
Select a field
+
{{ $t('labels.multiField.selectField') }}
- Make changes to field properties by selecting a field from the list + {{ $t('labels.multiField.selectFieldLabel') }}
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json index 9b8cc2bf60..b001e929a2 100644 --- a/packages/nc-gui/lang/en.json +++ b/packages/nc-gui/lang/en.json @@ -157,6 +157,8 @@ "groupingField": "Grouping Field", "insertAfter": "Insert After", "insertBefore": "Insert Before", + "insertAbove": "Insert above", + "insertBelow": "Insert below", "hideField": "Hide Field", "sortAsc": "Sort Ascending", "sortDesc": "Sort Descending", @@ -189,7 +191,8 @@ "shift": "Shift", "enter": "Enter", "seconds": "Seconds", - "paste": "Paste" + "paste": "Paste", + "restore": "Restore" }, "objects": { "workspace": "Workspace", @@ -642,7 +645,16 @@ "changeWsName": "Change Workspace Name", "pressEnter": "Press Enter", "newFormLoaded": "New form will be loaded after", - "webhook": "Webhook" + "webhook": "Webhook", + "multiField": { + "newField": "New field", + "saveChanges": "Save changes", + "updatedField": "Updated field", + "deletedField": "Deleted field", + "incompleteConfiguration": "Incomplete configuration", + "selectField": "Select a field", + "selectFieldLabel": "Make changes to field properties by selecting a field from the list" + } }, "activity": { "openInANewTab": "Open in a new tab", @@ -1048,7 +1060,12 @@ "barcodeFieldsCannotBeDirectlyChanged": "Warning: Barcode fields cannot be directly changed." }, "duplicateProject": "Are you sure you want to duplicate the base?", - "duplicateTable": "Are you sure you want to duplicate the table?" + "duplicateTable": "Are you sure you want to duplicate the table?", + "multiField": { + "fieldVisibility": "You cannot change visibility of a field that is being edited. Please save or discard changes first.", + "moveEditedField": "You cannot move field that is being edited. Either save or discard changes first", + "moveDeletedField": "You cannot move field that is deleted. Either save or discard changes first" + } }, "info": { "disabledAsViewLocked": "Disabled as View is locked", @@ -1211,7 +1228,8 @@ "goToNext": "Go to next", "thankYou": "Thank you!", "submittedFormData": "You have successfully submitted the form data.", - "editingSystemKeyNotSupported": "Editing system key not supported" + "editingSystemKeyNotSupported": "Editing system key not supported", + "notAvailableAtTheMoment": "Not available at the moment" }, "error": { "nameRequired": "Name Required", @@ -1289,7 +1307,9 @@ "fieldRequired": "{value} cannot be empty.", "projectNotAccessible": "Base not accessible", "copyToClipboardError": "Failed to copy to clipboard", - "pasteFromClipboardError": "Failed to paste from clipboard" + "pasteFromClipboardError": "Failed to paste from clipboard", + "multiFieldSaveValidation": "Please complete the configuration of all fields before saving", + "somethingWentWrong": "Something went wrong" }, "toast": { "exportMetadata": "Base metadata exported successfully",