Show error if default lang isn't loaded
This commit is contained in:
parent
e8d4de37e6
commit
59bb490069
|
@ -84,7 +84,11 @@ Common.Locale = new(function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var _getCurrentLanguage = function() {
|
var _getCurrentLanguage = function() {
|
||||||
return (currentLang || defLang);
|
return currentLang;
|
||||||
|
};
|
||||||
|
|
||||||
|
var _getLoadedLanguage = function() {
|
||||||
|
return loadedLang;
|
||||||
};
|
};
|
||||||
|
|
||||||
var _getUrlParameterByName = function(name) {
|
var _getUrlParameterByName = function(name) {
|
||||||
|
@ -109,9 +113,12 @@ Common.Locale = new(function() {
|
||||||
}
|
}
|
||||||
return response.json();
|
return response.json();
|
||||||
}).then(function(response) {
|
}).then(function(response) {
|
||||||
if ( response.json )
|
if ( response.json ) {
|
||||||
|
if (!response.ok)
|
||||||
|
throw new Error('server error');
|
||||||
|
|
||||||
return response.json();
|
return response.json();
|
||||||
else {
|
} else {
|
||||||
l10n = response;
|
l10n = response;
|
||||||
/* to break promises chain */
|
/* to break promises chain */
|
||||||
throw new Error('loaded');
|
throw new Error('loaded');
|
||||||
|
@ -123,8 +130,10 @@ Common.Locale = new(function() {
|
||||||
l10n = l10n || {};
|
l10n = l10n || {};
|
||||||
apply && _applyLocalization();
|
apply && _applyLocalization();
|
||||||
if ( e.message == 'loaded' ) {
|
if ( e.message == 'loaded' ) {
|
||||||
} else
|
} else {
|
||||||
|
currentLang = null;
|
||||||
console.log('fetch error: ' + e);
|
console.log('fetch error: ' + e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -632,7 +632,7 @@ define([
|
||||||
|
|
||||||
this.$window = $('#' + this.initConfig.id);
|
this.$window = $('#' + this.initConfig.id);
|
||||||
|
|
||||||
if (Common.Locale.getCurrentLanguage() !== 'en')
|
if (Common.Locale.getCurrentLanguage() && Common.Locale.getCurrentLanguage() !== 'en')
|
||||||
this.$window.attr('applang', Common.Locale.getCurrentLanguage());
|
this.$window.attr('applang', Common.Locale.getCurrentLanguage());
|
||||||
|
|
||||||
this.binding.keydown = _.bind(_keydown,this);
|
this.binding.keydown = _.bind(_keydown,this);
|
||||||
|
|
|
@ -1250,7 +1250,7 @@ define([
|
||||||
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
||||||
this._state.licenseType = licType;
|
this._state.licenseType = licType;
|
||||||
|
|
||||||
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
|
if ( this.onServerVersion(params.asc_getBuildVersion()) || !this.onLanguageLoaded()) return;
|
||||||
|
|
||||||
this.permissions.review = (this.permissions.review === undefined) ? (this.permissions.edit !== false) : this.permissions.review;
|
this.permissions.review = (this.permissions.review === undefined) ? (this.permissions.edit !== false) : this.permissions.review;
|
||||||
|
|
||||||
|
@ -2476,6 +2476,18 @@ define([
|
||||||
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLanguageLoaded: function() {
|
||||||
|
if (!Common.Locale.getCurrentLanguage()) {
|
||||||
|
Common.UI.warning({
|
||||||
|
msg: this.errorLang,
|
||||||
|
callback: function() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||||
criticalErrorTitle: 'Error',
|
criticalErrorTitle: 'Error',
|
||||||
notcriticalErrorTitle: 'Warning',
|
notcriticalErrorTitle: 'Warning',
|
||||||
|
@ -2844,7 +2856,8 @@ define([
|
||||||
txtNoTableOfFigures: "No table of figures entries found.",
|
txtNoTableOfFigures: "No table of figures entries found.",
|
||||||
txtTableOfFigures: 'Table of figures',
|
txtTableOfFigures: 'Table of figures',
|
||||||
txtStyle_endnote_text: 'Endnote Text',
|
txtStyle_endnote_text: 'Endnote Text',
|
||||||
txtTOCHeading: 'TOC Heading'
|
txtTOCHeading: 'TOC Heading',
|
||||||
|
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), DE.Controllers.Main || {}))
|
})(), DE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -783,7 +783,7 @@ define([
|
||||||
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
||||||
me._state.licenseType = licType;
|
me._state.licenseType = licType;
|
||||||
|
|
||||||
if ( me.onServerVersion(params.asc_getBuildVersion()) ) return;
|
if ( me.onServerVersion(params.asc_getBuildVersion()) || !me.onLanguageLoaded()) return;
|
||||||
|
|
||||||
me.appOptions.permissionsLicense = licType;
|
me.appOptions.permissionsLicense = licType;
|
||||||
me.permissions.review = (me.permissions.review === undefined) ? (me.permissions.edit !== false) : me.permissions.review;
|
me.permissions.review = (me.permissions.review === undefined) ? (me.permissions.edit !== false) : me.permissions.review;
|
||||||
|
@ -1497,6 +1497,17 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLanguageLoaded: function() {
|
||||||
|
if (!Common.Locale.getCurrentLanguage()) {
|
||||||
|
uiApp.alert(
|
||||||
|
this.errorLang,
|
||||||
|
this.notcriticalErrorTitle
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
|
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||||
criticalErrorTitle: 'Error',
|
criticalErrorTitle: 'Error',
|
||||||
notcriticalErrorTitle: 'Warning',
|
notcriticalErrorTitle: 'Warning',
|
||||||
|
@ -1643,7 +1654,8 @@ define([
|
||||||
txtEvenPage: "Even Page",
|
txtEvenPage: "Even Page",
|
||||||
txtOddPage: "Odd Page",
|
txtOddPage: "Odd Page",
|
||||||
txtSameAsPrev: "Same as Previous",
|
txtSameAsPrev: "Same as Previous",
|
||||||
txtCurrentDocument: "Current Document"
|
txtCurrentDocument: "Current Document",
|
||||||
|
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), DE.Controllers.Main || {}))
|
})(), DE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -976,7 +976,7 @@ define([
|
||||||
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
||||||
this._state.licenseType = licType;
|
this._state.licenseType = licType;
|
||||||
|
|
||||||
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
|
if ( this.onServerVersion(params.asc_getBuildVersion()) || !this.onLanguageLoaded() ) return;
|
||||||
|
|
||||||
if (params.asc_getRights() !== Asc.c_oRights.Edit)
|
if (params.asc_getRights() !== Asc.c_oRights.Edit)
|
||||||
this.permissions.edit = false;
|
this.permissions.edit = false;
|
||||||
|
@ -2107,6 +2107,18 @@ define([
|
||||||
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLanguageLoaded: function() {
|
||||||
|
if (!Common.Locale.getCurrentLanguage()) {
|
||||||
|
Common.UI.warning({
|
||||||
|
msg: this.errorLang,
|
||||||
|
callback: function() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||||
criticalErrorTitle: 'Error',
|
criticalErrorTitle: 'Error',
|
||||||
|
@ -2469,7 +2481,8 @@ define([
|
||||||
textRenameLabel: 'Enter a name to be used for collaboration',
|
textRenameLabel: 'Enter a name to be used for collaboration',
|
||||||
textRenameError: 'User name must not be empty.',
|
textRenameError: 'User name must not be empty.',
|
||||||
textLongName: 'Enter a name that is less than 128 characters.',
|
textLongName: 'Enter a name that is less than 128 characters.',
|
||||||
textGuest: 'Guest'
|
textGuest: 'Guest',
|
||||||
|
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), PE.Controllers.Main || {}))
|
})(), PE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -715,7 +715,7 @@ define([
|
||||||
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
||||||
me._state.licenseType = licType;
|
me._state.licenseType = licType;
|
||||||
|
|
||||||
if ( me.onServerVersion(params.asc_getBuildVersion()) ) return;
|
if ( me.onServerVersion(params.asc_getBuildVersion()) || !me.onLanguageLoaded() ) return;
|
||||||
|
|
||||||
me.appOptions.permissionsLicense = licType;
|
me.appOptions.permissionsLicense = licType;
|
||||||
me.permissions.review = (me.permissions.review === undefined) ? (me.permissions.edit !== false) : me.permissions.review;
|
me.permissions.review = (me.permissions.review === undefined) ? (me.permissions.edit !== false) : me.permissions.review;
|
||||||
|
@ -1398,6 +1398,17 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLanguageLoaded: function() {
|
||||||
|
if (!Common.Locale.getCurrentLanguage()) {
|
||||||
|
uiApp.alert(
|
||||||
|
this.errorLang,
|
||||||
|
this.notcriticalErrorTitle
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
|
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||||
criticalErrorTitle: 'Error',
|
criticalErrorTitle: 'Error',
|
||||||
|
@ -1573,7 +1584,8 @@ define([
|
||||||
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
warnLicenseLimitedRenewed: 'License needs to be renewed.<br>You have a limited access to document editing functionality.<br>Please contact your administrator to get full access',
|
||||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||||
textGuest: 'Guest',
|
textGuest: 'Guest',
|
||||||
txtAddFirstSlide: 'Click to add first slide'
|
txtAddFirstSlide: 'Click to add first slide',
|
||||||
|
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), PE.Controllers.Main || {}))
|
})(), PE.Controllers.Main || {}))
|
||||||
});
|
});
|
|
@ -1049,7 +1049,7 @@ define([
|
||||||
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
||||||
this._state.licenseType = licType;
|
this._state.licenseType = licType;
|
||||||
|
|
||||||
if ( this.onServerVersion(params.asc_getBuildVersion()) ) return;
|
if ( this.onServerVersion(params.asc_getBuildVersion()) || !this.onLanguageLoaded() ) return;
|
||||||
|
|
||||||
if (params.asc_getRights() !== Asc.c_oRights.Edit)
|
if (params.asc_getRights() !== Asc.c_oRights.Edit)
|
||||||
this.permissions.edit = false;
|
this.permissions.edit = false;
|
||||||
|
@ -2452,6 +2452,18 @@ define([
|
||||||
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
this._renameDialog.show(Common.Utils.innerWidth() - this._renameDialog.options.width - 15, 30);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLanguageLoaded: function() {
|
||||||
|
if (!Common.Locale.getCurrentLanguage()) {
|
||||||
|
Common.UI.warning({
|
||||||
|
msg: this.errorLang,
|
||||||
|
callback: function() {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||||
criticalErrorTitle: 'Error',
|
criticalErrorTitle: 'Error',
|
||||||
notcriticalErrorTitle: 'Warning',
|
notcriticalErrorTitle: 'Warning',
|
||||||
|
@ -2849,7 +2861,8 @@ define([
|
||||||
errorPasteMultiSelect: 'This action cannot be done on a multiple range selection.<br>Select a single range and try again.',
|
errorPasteMultiSelect: 'This action cannot be done on a multiple range selection.<br>Select a single range and try again.',
|
||||||
errorPivotWithoutUnderlying: 'The Pivot Table report was saved without the underlying data.<br>Use the \'Refresh\' button to update the report.',
|
errorPivotWithoutUnderlying: 'The Pivot Table report was saved without the underlying data.<br>Use the \'Refresh\' button to update the report.',
|
||||||
txtQuarter: 'Qtr',
|
txtQuarter: 'Qtr',
|
||||||
txtOr: '%1 or %2'
|
txtOr: '%1 or %2',
|
||||||
|
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), SSE.Controllers.Main || {}))
|
})(), SSE.Controllers.Main || {}))
|
||||||
});
|
});
|
||||||
|
|
|
@ -741,7 +741,7 @@ define([
|
||||||
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
if (Asc.c_oLicenseResult.ExpiredLimited === licType)
|
||||||
me._state.licenseType = licType;
|
me._state.licenseType = licType;
|
||||||
|
|
||||||
if ( me.onServerVersion(params.asc_getBuildVersion()) ) return;
|
if ( me.onServerVersion(params.asc_getBuildVersion()) || !me.onLanguageLoaded() ) return;
|
||||||
|
|
||||||
if (params.asc_getRights() !== Asc.c_oRights.Edit) {
|
if (params.asc_getRights() !== Asc.c_oRights.Edit) {
|
||||||
me.permissions.edit = false;
|
me.permissions.edit = false;
|
||||||
|
@ -1601,6 +1601,17 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onLanguageLoaded: function() {
|
||||||
|
if (!Common.Locale.getCurrentLanguage()) {
|
||||||
|
uiApp.alert(
|
||||||
|
this.errorLang,
|
||||||
|
this.notcriticalErrorTitle
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
|
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' to await the autosave of the document. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||||
criticalErrorTitle: 'Error',
|
criticalErrorTitle: 'Error',
|
||||||
notcriticalErrorTitle: 'Warning',
|
notcriticalErrorTitle: 'Warning',
|
||||||
|
@ -1795,7 +1806,8 @@ define([
|
||||||
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
warnLicenseLimitedNoAccess: 'License expired.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||||
textGuest: 'Guest',
|
textGuest: 'Guest',
|
||||||
errorDataValidate: 'The value you entered is not valid.<br>A user has restricted values that can be entered into this cell.',
|
errorDataValidate: 'The value you entered is not valid.<br>A user has restricted values that can be entered into this cell.',
|
||||||
errorLockedCellPivot: 'You cannot change data inside a pivot table.'
|
errorLockedCellPivot: 'You cannot change data inside a pivot table.',
|
||||||
|
errorLang: 'The interface language is not loaded.<br>Please contact your Document Server administrator.'
|
||||||
}
|
}
|
||||||
})(), SSE.Controllers.Main || {}))
|
})(), SSE.Controllers.Main || {}))
|
||||||
});
|
});
|
Loading…
Reference in a new issue