Web: Files: Fixed translation for file dialog.

This commit is contained in:
Tatiana Lopaeva 2021-11-18 09:16:40 +03:00
parent 68d889fb2b
commit d113abe541
8 changed files with 34 additions and 18 deletions

View File

@ -83,6 +83,5 @@
"ViewList": "List", "ViewList": "List",
"ViewTiles": "Tiles", "ViewTiles": "Tiles",
"NewMasterForm": "New master form", "NewMasterForm": "New master form",
"ViewTiles": "Tiles", "ViewTiles": "Tiles"
"Create": "Create"
} }

View File

@ -1,3 +1,4 @@
{ {
"SelectFile": "Select file" "SelectFile": "Select file",
"Create": "Create"
} }

View File

@ -81,6 +81,5 @@
"UnblockVersion": "Заблокировать/Разблокировать", "UnblockVersion": "Заблокировать/Разблокировать",
"UploadToFolder": "Загрузить в папку", "UploadToFolder": "Загрузить в папку",
"ViewList": "Список", "ViewList": "Список",
"ViewTiles": "Плитки", "ViewTiles": "Плитки"
"Create": "Создать"
} }

View File

@ -1,3 +1,4 @@
{ {
"SelectFile": "Выбрать файл" "SelectFile": "Выбрать файл",
"Create": "Создать"
} }

View File

@ -44,10 +44,13 @@ const Panels = (props) => {
selectFileDialogVisible, selectFileDialogVisible,
setSelectFileDialogVisible, setSelectFileDialogVisible,
} = props; } = props;
const { t } = useTranslation(["Article", "Home"]);
const { t } = useTranslation("Article");
const onClose = () => { const onClose = () => {
setSelectFileDialogVisible(false); setSelectFileDialogVisible(false);
}; };
return [ return [
uploadPanelVisible && <UploadPanel key="upload-panel" />, uploadPanelVisible && <UploadPanel key="upload-panel" />,
sharingPanelVisible && ( sharingPanelVisible && (
@ -88,8 +91,9 @@ const Panels = (props) => {
onClose={onClose} onClose={onClose}
foldersType="exceptPrivacyTrashFolders" foldersType="exceptPrivacyTrashFolders"
isDocumentsOnly isDocumentsOnly
searchParam={"docx"}
headerName={t("Article:CreateMasterFormFromFile")} headerName={t("Article:CreateMasterFormFromFile")}
buttonName={t("Home:Create")} creationButtonPrimary
/> />
), ),
]; ];

View File

@ -44,7 +44,7 @@ const SelectFileDialogAsideView = ({
passedId, passedId,
headerName, headerName,
isAvailableFolderList, isAvailableFolderList,
buttonName, primaryButtonName,
}) => { }) => {
const [isLoadingData, setIsLoadingData] = useState(false); const [isLoadingData, setIsLoadingData] = useState(false);
const onSetLoadingData = (loading) => { const onSetLoadingData = (loading) => {
@ -134,13 +134,13 @@ const SelectFileDialogAsideView = ({
className="select-file-dialog-buttons-save" className="select-file-dialog-buttons-save"
primary primary
size="big" size="big"
label={buttonName ? buttonName : t("Common:SaveButton")} label={primaryButtonName}
onClick={onClickSave} onClick={onClickSave}
isDisabled={selectedFile.length === 0} isDisabled={selectedFile.length === 0}
/> />
<Button <Button
size="big" size="big"
label={t("Common:CloseButton")} label={t("Common:CancelButton")}
onClick={onClose} onClick={onClose}
/> />
</div> </div>

View File

@ -176,7 +176,7 @@ class SelectFileDialogModalView extends React.Component {
selectedFile, selectedFile,
onClickSave, onClickSave,
headerName, headerName,
buttonName, primaryButtonName,
} = this.props; } = this.props;
const { isLoading, isAvailable } = this.state; const { isLoading, isAvailable } = this.state;
@ -251,14 +251,14 @@ class SelectFileDialogModalView extends React.Component {
className="select-file-modal-dialog-buttons-save" className="select-file-modal-dialog-buttons-save"
primary primary
size="medium" size="medium"
label={buttonName ? buttonName : t("Common:SaveButton")} label={primaryButtonName}
onClick={onClickSave} onClick={onClickSave}
isDisabled={selectedFile.length === 0} isDisabled={selectedFile.length === 0}
/> />
<Button <Button
className="modal-dialog-button" className="modal-dialog-button"
size="medium" size="medium"
label={t("Common:CloseButton")} label={t("Common:CancelButton")}
onClick={onClose} onClick={onClose}
/> />
</div> </div>

View File

@ -24,7 +24,18 @@ const { auth: authStore } = store;
class SelectFileDialogBody extends React.Component { class SelectFileDialogBody extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
const { folderId, storeFolderId, fileInfo, filter } = this.props; const {
folderId,
storeFolderId,
fileInfo,
filter,
creationButtonPrimary,
t,
} = this.props;
this.buttonName = creationButtonPrimary
? t("Create")
: t("Common:SaveButton");
this.state = { this.state = {
isVisible: false, isVisible: false,
@ -238,7 +249,6 @@ class SelectFileDialogBody extends React.Component {
onSetFileName, onSetFileName,
tReady, tReady,
headerName, headerName,
buttonName,
} = this.props; } = this.props;
const { const {
isVisible, isVisible,
@ -287,7 +297,7 @@ class SelectFileDialogBody extends React.Component {
passedId={passedId} passedId={passedId}
header={header} header={header}
isAvailableFolderList={isAvailableFolderList} isAvailableFolderList={isAvailableFolderList}
buttonName={buttonName} primaryButtonName={this.buttonName}
/> />
) : ( ) : (
<SelectFileDialogModalView <SelectFileDialogModalView
@ -310,7 +320,7 @@ class SelectFileDialogBody extends React.Component {
folderId={folderId} folderId={folderId}
passedId={passedId} passedId={passedId}
header={header} header={header}
buttonName={buttonName} primaryButtonName={this.buttonName}
/> />
); );
} }
@ -328,6 +338,7 @@ SelectFileDialogBody.propTypes = {
]), ]),
folderId: PropTypes.string, folderId: PropTypes.string,
withoutProvider: PropTypes.bool, withoutProvider: PropTypes.bool,
creationButtonPrimary: PropTypes.bool,
headerName: PropTypes.string, headerName: PropTypes.string,
zIndex: PropTypes.number, zIndex: PropTypes.number,
}; };
@ -337,6 +348,7 @@ SelectFileDialogBody.defaultProps = {
header: "", header: "",
withoutProvider: false, withoutProvider: false,
zIndex: 310, zIndex: 310,
creationButtonPrimary: false,
}; };
const SelectFileDialogWrapper = inject( const SelectFileDialogWrapper = inject(