[Mobile] Fix translation on loading (open as anonymous)

This commit is contained in:
Julia Radzhabova 2022-04-18 20:16:27 +03:00
parent a0437e9dbc
commit 4a66c76aeb
3 changed files with 56 additions and 26 deletions

View file

@ -80,8 +80,8 @@ class MainController extends Component {
};
const loadConfig = data => {
const _t = this._t;
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
EditorUIController.isSupportEditFeature();
this.editorConfig = Object.assign({}, this.editorConfig, data.config);
@ -183,13 +183,15 @@ class MainController extends Component {
const onEditorPermissions = params => {
const licType = params.asc_getLicenseType();
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
// check licType
if (Asc.c_oLicenseResult.Expired === licType ||
Asc.c_oLicenseResult.Error === licType ||
Asc.c_oLicenseResult.ExpiredTrial === licType) {
f7.dialog.create({
title : this._t.titleLicenseExp,
text : this._t.warnLicenseExp
title : _t.titleLicenseExp,
text : _t.warnLicenseExp
}).open();
return;
}
@ -409,7 +411,9 @@ class MainController extends Component {
this.api.asc_continueSaving();
}, 500);
return this._t.leavePageText;
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
return _t.leavePageText;
}
}
@ -536,7 +540,8 @@ class MainController extends Component {
onServerVersion (buildVersion) {
if (this.changeServerVersion) return true;
const _t = this._t;
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
if (About.appVersion() !== buildVersion && !About.compareVersions()) {
this.changeServerVersion = true;
@ -807,7 +812,9 @@ class MainController extends Component {
this.api.asc_OnSaveEnd(data.result);
if (data && data.result === false) {
const _t = this._t;
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
f7.dialog.alert(
(!data.message) ? _t.errorProcessSaveResult : data.message,
_t.criticalErrorTitle
@ -824,7 +831,9 @@ class MainController extends Component {
Common.Notifications.trigger('api:disconnect');
if (!old_rights) {
const _t = this._t;
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
f7.dialog.alert(
(!data.message) ? _t.warnProcessRightsChange : data.message,
_t.notcriticalErrorTitle,
@ -837,7 +846,9 @@ class MainController extends Component {
onDownloadAs () {
const appOptions = this.props.storeAppOptions;
if ( !appOptions.canDownload && !appOptions.canDownloadOrigin) {
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this._t.errorAccessDeny);
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, _t.errorAccessDeny);
return;
}
@ -864,7 +875,8 @@ class MainController extends Component {
}
onUpdateVersion (callback) {
const _t = this._t;
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
this.needToUpdateVersion = true;
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
@ -956,7 +968,8 @@ class MainController extends Component {
if (value === 1) {
this.api.asc_runAutostartMacroses();
} else if (value === 0) {
const _t = this._t;
const { t } = this.props;
const _t = t('Main', {returnObjects:true});
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.textHasMacros,

View file

@ -73,7 +73,8 @@ class MainController extends Component {
};
const loadConfig = data => {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
EditorUIController.isSupportEditFeature();
@ -289,7 +290,9 @@ class MainController extends Component {
this.api.asc_continueSaving();
}, 500);
return this._t.leavePageText;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
return _t.leavePageText;
}
}
@ -607,7 +610,8 @@ class MainController extends Component {
}
onUpdateVersion (callback) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
this.needToUpdateVersion = true;
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
@ -626,7 +630,8 @@ class MainController extends Component {
onServerVersion (buildVersion) {
if (this.changeServerVersion) return true;
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
if (About.appVersion() !== buildVersion && !window.compareVersions) {
this.changeServerVersion = true;
@ -774,7 +779,8 @@ class MainController extends Component {
if (value === 1) {
this.api.asc_runAutostartMacroses();
} else if (value === 0) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.textHasMacros,
@ -816,7 +822,8 @@ class MainController extends Component {
this.api.asc_OnSaveEnd(data.result);
if (data && data.result === false) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
f7.dialog.alert(
(!data.message) ? _t.errorProcessSaveResult : data.message,
_t.criticalErrorTitle
@ -833,7 +840,8 @@ class MainController extends Component {
Common.Notifications.trigger('api:disconnect');
if (!old_rights) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
f7.dialog.alert(
(!data.message) ? _t.warnProcessRightsChange : data.message,
_t.notcriticalErrorTitle,

View file

@ -91,7 +91,8 @@ class MainController extends Component {
};
const loadConfig = data => {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
EditorUIController.isSupportEditFeature();
@ -749,7 +750,8 @@ class MainController extends Component {
if (value === 1) {
this.api.asc_runAutostartMacroses();
} else if (value === 0) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
f7.dialog.create({
title: _t.notcriticalErrorTitle,
text: _t.textHasMacros,
@ -796,7 +798,8 @@ class MainController extends Component {
}
onBeforeUnload () {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
LocalStorage.save();
@ -818,7 +821,8 @@ class MainController extends Component {
}
onUpdateVersion (callback) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
this.needToUpdateVersion = true;
Common.Notifications.trigger('preloader:endAction', Asc.c_oAscAsyncActionType['BlockInteraction'], this.LoadingDocument);
@ -837,7 +841,8 @@ class MainController extends Component {
onServerVersion (buildVersion) {
if (this.changeServerVersion) return true;
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
if (About.appVersion() !== buildVersion && !About.compareVersions()) {
this.changeServerVersion = true;
@ -923,7 +928,8 @@ class MainController extends Component {
this.api.asc_OnSaveEnd(data.result);
if (data && data.result === false) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
f7.dialog.alert(
(!data.message) ? _t.errorProcessSaveResult : data.message,
_t.criticalErrorTitle
@ -940,7 +946,8 @@ class MainController extends Component {
Common.Notifications.trigger('api:disconnect');
if (!old_rights) {
const _t = this._t;
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
f7.dialog.alert(
(!data.message) ? _t.warnProcessRightsChange : data.message,
_t.notcriticalErrorTitle,
@ -952,7 +959,9 @@ class MainController extends Component {
onDownloadAs () {
if ( this.props.storeAppOptions.canDownload) {
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, this._t.errorAccessDeny);
const { t } = this.props;
const _t = t('Controller.Main', {returnObjects:true});
Common.Gateway.reportError(Asc.c_oAscError.ID.AccessDeny, _t.errorAccessDeny);
return;
}
this._state.isFromGatewayDownloadAs = true;