diff --git a/apps/common/locale.js b/apps/common/locale.js
index bcd4270ba..abed04e94 100644
--- a/apps/common/locale.js
+++ b/apps/common/locale.js
@@ -84,7 +84,11 @@ Common.Locale = new(function() {
};
var _getCurrentLanguage = function() {
- return (currentLang || defLang);
+ return currentLang;
+ };
+
+ var _getLoadedLanguage = function() {
+ return loadedLang;
};
var _getUrlParameterByName = function(name) {
@@ -109,9 +113,12 @@ Common.Locale = new(function() {
}
return response.json();
}).then(function(response) {
- if ( response.json )
+ if ( response.json ) {
+ if (!response.ok)
+ throw new Error('server error');
+
return response.json();
- else {
+ } else {
l10n = response;
/* to break promises chain */
throw new Error('loaded');
@@ -123,8 +130,10 @@ Common.Locale = new(function() {
l10n = l10n || {};
apply && _applyLocalization();
if ( e.message == 'loaded' ) {
- } else
+ } else {
+ currentLang = null;
console.log('fetch error: ' + e);
+ }
});
};
diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js
index 661424bc2..95edd58b9 100644
--- a/apps/common/main/lib/component/Window.js
+++ b/apps/common/main/lib/component/Window.js
@@ -632,7 +632,7 @@ define([
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.binding.keydown = _.bind(_keydown,this);
diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js
index 183a3194a..b74fd5b0e 100644
--- a/apps/documenteditor/main/app/controller/Main.js
+++ b/apps/documenteditor/main/app/controller/Main.js
@@ -1250,7 +1250,7 @@ define([
if (Asc.c_oLicenseResult.ExpiredLimited === 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;
@@ -2476,6 +2476,18 @@ define([
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.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@@ -2844,7 +2856,8 @@ define([
txtNoTableOfFigures: "No table of figures entries found.",
txtTableOfFigures: 'Table of figures',
txtStyle_endnote_text: 'Endnote Text',
- txtTOCHeading: 'TOC Heading'
+ txtTOCHeading: 'TOC Heading',
+ errorLang: 'The interface language is not loaded.
Please contact your Document Server administrator.'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/documenteditor/mobile/app/controller/Main.js b/apps/documenteditor/mobile/app/controller/Main.js
index 66f8d59fc..9f6c281d5 100644
--- a/apps/documenteditor/mobile/app/controller/Main.js
+++ b/apps/documenteditor/mobile/app/controller/Main.js
@@ -783,7 +783,7 @@ define([
if (Asc.c_oLicenseResult.ExpiredLimited === 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.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.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@@ -1643,7 +1654,8 @@ define([
txtEvenPage: "Even Page",
txtOddPage: "Odd Page",
txtSameAsPrev: "Same as Previous",
- txtCurrentDocument: "Current Document"
+ txtCurrentDocument: "Current Document",
+ errorLang: 'The interface language is not loaded.
Please contact your Document Server administrator.'
}
})(), DE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js
index c2fcc6337..764938ed8 100644
--- a/apps/presentationeditor/main/app/controller/Main.js
+++ b/apps/presentationeditor/main/app/controller/Main.js
@@ -976,7 +976,7 @@ define([
if (Asc.c_oLicenseResult.ExpiredLimited === 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)
this.permissions.edit = false;
@@ -2107,6 +2107,18 @@ define([
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
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',
@@ -2469,7 +2481,8 @@ define([
textRenameLabel: 'Enter a name to be used for collaboration',
textRenameError: 'User name must not be empty.',
textLongName: 'Enter a name that is less than 128 characters.',
- textGuest: 'Guest'
+ textGuest: 'Guest',
+ errorLang: 'The interface language is not loaded.
Please contact your Document Server administrator.'
}
})(), PE.Controllers.Main || {}))
});
diff --git a/apps/presentationeditor/mobile/app/controller/Main.js b/apps/presentationeditor/mobile/app/controller/Main.js
index 4c9c14894..2c66e159b 100644
--- a/apps/presentationeditor/mobile/app/controller/Main.js
+++ b/apps/presentationeditor/mobile/app/controller/Main.js
@@ -715,7 +715,7 @@ define([
if (Asc.c_oLicenseResult.ExpiredLimited === 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.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
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',
@@ -1573,7 +1584,8 @@ define([
warnLicenseLimitedRenewed: 'License needs to be renewed.
You have a limited access to document editing functionality.
Please contact your administrator to get full access',
warnLicenseLimitedNoAccess: 'License expired.
You have no access to document editing functionality.
Please contact your administrator.',
textGuest: 'Guest',
- txtAddFirstSlide: 'Click to add first slide'
+ txtAddFirstSlide: 'Click to add first slide',
+ errorLang: 'The interface language is not loaded.
Please contact your Document Server administrator.'
}
})(), PE.Controllers.Main || {}))
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js
index d674000e4..3e34f052c 100644
--- a/apps/spreadsheeteditor/main/app/controller/Main.js
+++ b/apps/spreadsheeteditor/main/app/controller/Main.js
@@ -1049,7 +1049,7 @@ define([
if (Asc.c_oLicenseResult.ExpiredLimited === 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)
this.permissions.edit = false;
@@ -2452,6 +2452,18 @@ define([
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.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@@ -2849,7 +2861,8 @@ define([
errorPasteMultiSelect: 'This action cannot be done on a multiple range selection.
Select a single range and try again.',
errorPivotWithoutUnderlying: 'The Pivot Table report was saved without the underlying data.
Use the \'Refresh\' button to update the report.',
txtQuarter: 'Qtr',
- txtOr: '%1 or %2'
+ txtOr: '%1 or %2',
+ errorLang: 'The interface language is not loaded.
Please contact your Document Server administrator.'
}
})(), SSE.Controllers.Main || {}))
});
diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js
index 07f75cbf8..e73df8db7 100644
--- a/apps/spreadsheeteditor/mobile/app/controller/Main.js
+++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js
@@ -741,7 +741,7 @@ define([
if (Asc.c_oLicenseResult.ExpiredLimited === 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) {
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.',
criticalErrorTitle: 'Error',
notcriticalErrorTitle: 'Warning',
@@ -1795,7 +1806,8 @@ define([
warnLicenseLimitedNoAccess: 'License expired.
You have no access to document editing functionality.
Please contact your administrator.',
textGuest: 'Guest',
errorDataValidate: 'The value you entered is not valid.
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.
Please contact your Document Server administrator.'
}
})(), SSE.Controllers.Main || {}))
});
\ No newline at end of file