From a23a194660e7eb2b75de3d3e678b09006f4ecead Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sun, 20 Oct 2024 10:05:44 +0800 Subject: [PATCH] add subtypes to imported file types --- src/consts/file.js | 30 +++++++++++-------- src/lib/i18n.js | 14 +++++++++ src/locales/en.json | 7 +++-- src/locales/zh_Hans.json | 7 +++-- .../list/dialogs/ImportDialog.vue | 28 ++++++++++++++++- 5 files changed, 66 insertions(+), 20 deletions(-) diff --git a/src/consts/file.js b/src/consts/file.js index 557e6535..ce353a8b 100644 --- a/src/consts/file.js +++ b/src/consts/file.js @@ -29,19 +29,23 @@ const supportedImportFileTypes = [ } }, { - type: 'qif_ymd', - name: 'Quicken Interchange Format (QIF) File (Year-month-day format)', - extensions: '.qif' - }, - { - type: 'qif_mdy', - name: 'Quicken Interchange Format (QIF) File (Month-day-year format)', - extensions: '.qif' - }, - { - type: 'qif_dmy', - name: 'Quicken Interchange Format (QIF) File (Day-month-year format)', - extensions: '.qif' + type: 'qif', + name: 'Quicken Interchange Format (QIF) File', + extensions: '.qif', + subTypes: [ + { + type: 'qif_ymd', + name: 'Year-month-day format', + }, + { + type: 'qif_mdy', + name: 'Month-day-year format', + }, + { + type: 'qif_dmy', + name: 'Day-month-year format', + } + ] }, { type: 'feidee_mymoney_csv', diff --git a/src/lib/i18n.js b/src/lib/i18n.js index 6627e736..b6ad5bdc 100644 --- a/src/lib/i18n.js +++ b/src/lib/i18n.js @@ -1299,10 +1299,24 @@ function getAllSupportedImportFileTypes(i18nGlobal, translateFn) { document = null; } + const subTypes = []; + + if (fileType.subTypes) { + for (let i = 0; i < fileType.subTypes.length; i++) { + const subType = fileType.subTypes[i]; + + subTypes.push({ + type: subType.type, + displayName: translateFn(subType.name), + }); + } + } + allSupportedImportFileTypes.push({ type: fileType.type, displayName: translateFn(fileType.name), extensions: fileType.extensions, + subTypes: subTypes.length ? subTypes : undefined, document: document }); } diff --git a/src/locales/en.json b/src/locales/en.json index 35ad3776..55cd53a0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1518,9 +1518,10 @@ "How to export this file?": "How to export this file?", "ezbookkeeping Data Export File (CSV)": "ezbookkeeping Data Export File (CSV)", "ezbookkeeping Data Export File (TSV)": "ezbookkeeping Data Export File (TSV)", - "Quicken Interchange Format (QIF) File (Year-month-day format)": "Quicken Interchange Format (QIF) File (Year-month-day format)", - "Quicken Interchange Format (QIF) File (Month-day-year format)": "Quicken Interchange Format (QIF) File (Month-day-year format)", - "Quicken Interchange Format (QIF) File (Day-month-year format)": "Quicken Interchange Format (QIF) File (Day-month-year format)", + "Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) File", + "Year-month-day format": "Year-month-day format", + "Month-day-year format": "Month-day-year format", + "Day-month-year format": "Day-month-year format", "Firefly III Data Export File": "Firefly III Data Export File", "Feidee MyMoney (App) Data Export File": "Feidee MyMoney (App) Data Export File", "Feidee MyMoney (Web) Data Export File": "Feidee MyMoney (Web) Data Export File", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 33812df5..8968cae6 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -1518,9 +1518,10 @@ "How to export this file?": "如何导出该文件?", "ezbookkeeping Data Export File (CSV)": "ezbookkeeping 数据导出文件 (CSV)", "ezbookkeeping Data Export File (TSV)": "ezbookkeeping 数据导出文件 (TSV)", - "Quicken Interchange Format (QIF) File (Year-month-day format)": "Quicken Interchange Format (QIF) 文件 (年-月-日 格式)", - "Quicken Interchange Format (QIF) File (Month-day-year format)": "Quicken Interchange Format (QIF) 文件 (月-日-年 格式)", - "Quicken Interchange Format (QIF) File (Day-month-year format)": "Quicken Interchange Format (QIF) 文件 (日-月-年 格式)", + "Quicken Interchange Format (QIF) File": "Quicken Interchange Format (QIF) 文件", + "Year-month-day format": "年-月-日 格式", + "Month-day-year format": "月-日-年 格式", + "Day-month-year format": "日-月-年 格式", "Firefly III Data Export File": "Firefly III 数据导出文件", "Feidee MyMoney (App) Data Export File": "金蝶随手记 (App) 数据导出文件", "Feidee MyMoney (Web) Data Export File": "金蝶随手记 (Web版) 数据导出文件", diff --git a/src/views/desktop/transactions/list/dialogs/ImportDialog.vue b/src/views/desktop/transactions/list/dialogs/ImportDialog.vue index 6a4ea4bc..cdf6591a 100644 --- a/src/views/desktop/transactions/list/dialogs/ImportDialog.vue +++ b/src/views/desktop/transactions/list/dialogs/ImportDialog.vue @@ -78,6 +78,18 @@ /> + + + + { const parsedTransactions = response.items;