[DE mobile] Correct translations and clear imports

This commit is contained in:
SergeyEzhin
2023-07-13 10:47:43 +03:00
parent bf1d419feb
commit 6705ed82a3
3 changed files with 33 additions and 27 deletions

View File

@ -1,4 +1,4 @@
import React, { useEffect, useRef, useState, version } from 'react';
import React, { useEffect, useRef } from 'react';
import { observer, inject } from "mobx-react";
import VersionHistoryView from '../view/VersionHistory';
import { f7, Sheet, Popover, View } from 'framework7-react';
@ -92,11 +92,11 @@ const VersionHistoryController = inject('storeAppOptions', 'storeVersionHistory'
}
f7.dialog.create({
title: t('Settings.notcriticalErrorTitle'),
text: (opts.data.error) ? opts.data.error : t('Settings.txtErrorLoadHistory'),
title: t('Common.VersionHistory.notcriticalErrorTitle'),
text: (opts.data.error) ? opts.data.error : t('Common.VersionHistory.txtErrorLoadHistory'),
buttons: [
{
text: t('Settings.textOk')
text: t('Common.VersionHistory.textOk')
}
]
}).open();
@ -124,7 +124,7 @@ const VersionHistoryController = inject('storeAppOptions', 'storeVersionHistory'
if (!user) {
user = {
id: version.user.id,
username: version.user.name || t('Settings.textAnonymous'),
username: version.user.name || t('Common.VersionHistory.textAnonymous'),
colorval: Asc.c_oAscArrUserColors[usersCnt],
color: generateUserColor(Asc.c_oAscArrUserColors[usersCnt++]),
@ -137,7 +137,7 @@ const VersionHistoryController = inject('storeAppOptions', 'storeVersionHistory'
version: version.versionGroup,
revision: version.version,
userid: version.user.id,
username: version.user.name || t('Settings.textAnonymous'),
username: version.user.name || t('Common.VersionHistory.textAnonymous'),
usercolor: user.color,
created: version.created,
docId: version.key,
@ -184,7 +184,7 @@ const VersionHistoryController = inject('storeAppOptions', 'storeVersionHistory'
if (!user) {
user = {
id: change.user.id,
username: change.user.name || t('Settings.textAnonymous'),
username: change.user.name || t('Common.VersionHistory.textAnonymous'),
colorval: Asc.c_oAscArrUserColors[usersCnt],
color: generateUserColor(Asc.c_oAscArrUserColors[usersCnt++]),
};
@ -197,7 +197,7 @@ const VersionHistoryController = inject('storeAppOptions', 'storeVersionHistory'
revision: version.version,
changeid: i,
userid: change.user.id,
username: change.user.name || t('Settings.textAnonymous'),
username: change.user.name || t('Common.VersionHistory.textAnonymous'),
usercolor: user.color,
created: change.created,
docId: version.key,
@ -260,11 +260,11 @@ const VersionHistoryController = inject('storeAppOptions', 'storeVersionHistory'
if (opts.data.error) {
f7.dialog.create({
title: t('Settings.notcriticalErrorTitle'),
title: t('Common.VersionHistory.notcriticalErrorTitle'),
text: opts.data.error,
buttons: [
{
text: t('Settings.textOk')
text: t('Common.VersionHistory.textOk')
}
]
}).open();
@ -329,15 +329,15 @@ const VersionHistoryController = inject('storeAppOptions', 'storeVersionHistory'
if (isRevision) {
f7.dialog.create({
title: t('Settings.titleWarningRestoreVersion'),
text: t('Settings.textWarningRestoreVersion'),
title: t('Common.VersionHistory.titleWarningRestoreVersion'),
text: t('Common.VersionHistory.textWarningRestoreVersion'),
buttons: [
{
text: t('Settings.textCancel'),
text: t('Common.VersionHistory.textCancel'),
bold: true
},
{
text: t('Settings.textRestore'),
text: t('Common.VersionHistory.textRestore'),
onClick: () => {
Common.Gateway.requestRestore(revision.revision, undefined, revision.fileType);
}

View File

@ -1,4 +1,4 @@
import React, { useCallback, useEffect } from 'react';
import React, { useCallback } from 'react';
import { Page, Navbar, BlockTitle, List, ListItem, Icon, NavRight, Link } from "framework7-react";
import { useTranslation } from "react-i18next";
import { observer, inject } from "mobx-react";
@ -11,7 +11,6 @@ const VersionHistoryView = inject('storeVersionHistory', 'users')(observer(props
const arrVersions = historyStore.arrVersions;
const currentVersion = historyStore.currentVersion;
const isNavigate = props.isNavigate;
const _t = t("Settings", { returnObjects: true });
const usersVersions = historyStore.usersVersions;
const handleClickRevision = useCallback(version => {
@ -22,7 +21,7 @@ const VersionHistoryView = inject('storeVersionHistory', 'users')(observer(props
return (
<Page className='page-version-history'>
<Navbar title={t('Settings.textVersionHistory')} backLink={!Device.phone && isNavigate ? _t.textBack : null}>
<Navbar title={t('Common.VersionHistory.textVersionHistory')} backLink={!Device.phone && isNavigate ? t('Common.VersionHistory.textBack') : null}>
{Device.phone ?
<NavRight>
<Link sheetClose="#version-history-sheet">
@ -40,13 +39,13 @@ const VersionHistoryView = inject('storeVersionHistory', 'users')(observer(props
{arrVersions.map((version, index) => {
return (
<div className={`version-history ${version.version === currentVersion.version ? 'version-history_active' : ''}`} key={index} onClick={() => handleClickRevision(version)}>
<BlockTitle className='version-history__title'>{`${version.selected ? t('Settings.textCurrent') + ' - ' : ''} ${t('Settings.textVersion')} ${version.revision}`}</BlockTitle>
<BlockTitle className='version-history__title'>{`${version.selected ? t('Common.VersionHistory.textCurrent') + ' - ' : ''} ${t('Common.VersionHistory.textVersion')} ${version.revision}`}</BlockTitle>
<List className='version-history__list' dividersIos mediaList outlineIos strongIos>
<ListItem link='#' title={version.created} subtitle={version.username} >
<div slot='media' className='version-history__user' style={{backgroundColor: usersVersions.find(user => user.id === version.userid).color}}>{usersStore.getInitials(version.username)}</div>
{(version.version === currentVersion.version && !version.selected && version.canRestore) &&
<div slot="inner">
<button type='button' className='version-history__btn' onClick={() => props.onRestoreRevision(version)}>{t('Settings.textRestore')}</button>
<button type='button' className='version-history__btn' onClick={() => props.onRestoreRevision(version)}>{t('Common.VersionHistory.textRestore')}</button>
</div>
}
</ListItem>

View File

@ -174,6 +174,20 @@
"textCustomColors": "Custom Colors",
"textStandartColors": "Standard Colors",
"textThemeColors": "Theme Colors"
},
"VersionHistory": {
"textVersionHistory": "Version History",
"textAnonymous": "Anonymous",
"txtErrorLoadHistory": "Loading history failed",
"textVersion": "Version",
"textCurrent": "Current",
"textRestore": "Restore",
"titleWarningRestoreVersion": "Restore this version?",
"textWarningRestoreVersion": "Current file will be saved in version history.",
"textBack": "Back",
"notcriticalErrorTitle": "Warning",
"textOk": "Ok",
"textCancel": "Cancel"
}
},
"ContextMenu": {
@ -726,14 +740,7 @@
"txtScheme7": "Equity",
"txtScheme8": "Flow",
"txtScheme9": "Foundry",
"textVersionHistory": "Version History",
"textAnonymous": "Anonymous",
"txtErrorLoadHistory": "Loading history failed",
"textVersion": "Version",
"textCurrent": "Current",
"textRestore": "Restore",
"titleWarningRestoreVersion": "Restore this version?",
"textWarningRestoreVersion": "Current file will be saved in version history."
"textVersionHistory": "Version History"
},
"Toolbar": {
"dlgLeaveMsgText": "You have unsaved changes. Click 'Stay on this Page' to wait for autosave. Click 'Leave this Page' to discard all the unsaved changes.",