diff --git a/src/action/AsyncImportActions.ts b/src/action/AsyncImportActions.ts index ff798973..a41d28b4 100644 --- a/src/action/AsyncImportActions.ts +++ b/src/action/AsyncImportActions.ts @@ -89,13 +89,16 @@ const processError = ); }; -export function downloadExcelTemplate() { +export function downloadExcelTemplate(translationsOnly: boolean = false) { return (dispatch: ThunkDispatch) => { const action = { type: ActionType.LOAD_EXCEL_TEMPLATE }; dispatch(asyncActionRequest(action, true)); return Ajax.getRaw( `${Constants.API_PREFIX}/vocabularies/import/template`, - responseType("arraybuffer") + responseType("arraybuffer").param( + "translationsOnly", + translationsOnly.toString() + ) ) .then((response) => { Utils.fileDownload( diff --git a/src/component/vocabulary/importing/ImportTranslationsDialog.tsx b/src/component/vocabulary/importing/ImportTranslationsDialog.tsx index 6ae4ddbc..d9efb1a8 100644 --- a/src/component/vocabulary/importing/ImportTranslationsDialog.tsx +++ b/src/component/vocabulary/importing/ImportTranslationsDialog.tsx @@ -1,6 +1,6 @@ import React from "react"; import UploadFile from "../../resource/file/UploadFile"; -import { Button, ButtonToolbar, Col, Form, Row } from "reactstrap"; +import { Alert, Button, ButtonToolbar, Col, Form, Row } from "reactstrap"; import { useI18n } from "../../hook/useI18n"; import { FormattedMessage } from "react-intl"; @@ -34,6 +34,9 @@ export const ImportTranslationsDialog: React.FC<{ }} /> + + + diff --git a/src/component/vocabulary/importing/LoadVocabularyFromFile.tsx b/src/component/vocabulary/importing/LoadVocabularyFromFile.tsx index 87266deb..f0ee0728 100644 --- a/src/component/vocabulary/importing/LoadVocabularyFromFile.tsx +++ b/src/component/vocabulary/importing/LoadVocabularyFromFile.tsx @@ -40,6 +40,9 @@ export const LoadVocabularyFromFile: React.FC = ({ const downloadTemplate = () => { dispatch(downloadExcelTemplate()); }; + const downloadTranslationsTemplate = () => { + dispatch(downloadExcelTemplate(true)); + }; const vocabularyNotEmpty = (useSelector((state: TermItState) => state.vocabulary.termCount) || 0) > 0; @@ -101,7 +104,7 @@ export const LoadVocabularyFromFile: React.FC = ({ ), }} diff --git a/src/i18n/cs.ts b/src/i18n/cs.ts index cb8a284a..a74b61f1 100644 --- a/src/i18n/cs.ts +++ b/src/i18n/cs.ts @@ -324,6 +324,8 @@ const cs = { "Slovník není prázdný, stávající data budou přepsána importovanými.", "vocabulary.summary.import.translations.label": "Nahrajte soubor ve formátu MS Excel odpovídající této šabloně, ze kterého mají být naimportovány překlady existujících pojmů ve slovníku.", + "vocabulary.summary.import.translations.help": + "Stávající data nebudou přepsána.", "vocabulary.import.type.skos": "SKOS", "vocabulary.import.type.excel": "MS Excel", "vocabulary.import.action": "Importovat", diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 84119adc..264ae219 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -316,6 +316,8 @@ const en = { "Vocabulary is not empty, existing data will be overwritten by the imported.", "vocabulary.summary.import.translations.label": "Upload an MS Excel file corresponding to this template from which translations of existing terms in this vocabulary will be imported.", + "vocabulary.summary.import.translations.help": + "Existing data will not be changed.", "vocabulary.import.type.skos": "SKOS", "vocabulary.import.type.excel": "MS Excel", "vocabulary.import.action": "Import",