commit
5dc775f830
|
@ -39,7 +39,8 @@ Common.Locale = new(function() {
|
|||
var l10n = null;
|
||||
var loadcallback,
|
||||
apply = false,
|
||||
currentLang = 'en';
|
||||
defLang = '{{DEFAULT_LANG}}',
|
||||
currentLang = defLang;
|
||||
|
||||
var _applyLocalization = function(callback) {
|
||||
try {
|
||||
|
@ -83,7 +84,11 @@ Common.Locale = new(function() {
|
|||
};
|
||||
|
||||
var _getCurrentLanguage = function() {
|
||||
return (currentLang || 'en');
|
||||
return currentLang;
|
||||
};
|
||||
|
||||
var _getLoadedLanguage = function() {
|
||||
return loadedLang;
|
||||
};
|
||||
|
||||
var _getUrlParameterByName = function(name) {
|
||||
|
@ -94,23 +99,26 @@ Common.Locale = new(function() {
|
|||
};
|
||||
|
||||
var _requireLang = function () {
|
||||
var lang = (_getUrlParameterByName('lang') || 'en').split(/[\-_]/)[0];
|
||||
var lang = (_getUrlParameterByName('lang') || defLang).split(/[\-_]/)[0];
|
||||
currentLang = lang;
|
||||
fetch('locale/' + lang + '.json')
|
||||
.then(function(response) {
|
||||
if (!response.ok) {
|
||||
currentLang = 'en';
|
||||
if (lang != 'en')
|
||||
currentLang = defLang;
|
||||
if (lang != defLang)
|
||||
/* load default lang if fetch failed */
|
||||
return fetch('locale/en.json');
|
||||
return fetch('locale/' + defLang + '.json');
|
||||
|
||||
throw new Error('server error');
|
||||
}
|
||||
return response.json();
|
||||
}).then(function(response) {
|
||||
if ( response.then )
|
||||
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');
|
||||
|
@ -122,8 +130,10 @@ Common.Locale = new(function() {
|
|||
l10n = l10n || {};
|
||||
apply && _applyLocalization();
|
||||
if ( e.message == 'loaded' ) {
|
||||
} else
|
||||
} else {
|
||||
currentLang = null;
|
||||
console.log('fetch error: ' + e);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -48,7 +48,7 @@ define([
|
|||
'common/main/lib/view/ExternalDiagramEditor'
|
||||
], function () { 'use strict';
|
||||
Common.Controllers.ExternalDiagramEditor = Backbone.Controller.extend(_.extend((function() {
|
||||
var appLang = 'en',
|
||||
var appLang = '{{DEFAULT_LANG}}',
|
||||
customization = undefined,
|
||||
targetApp = '',
|
||||
externalEditor = null,
|
||||
|
|
|
@ -48,7 +48,7 @@ define([
|
|||
'common/main/lib/view/ExternalMergeEditor'
|
||||
], function () { 'use strict';
|
||||
Common.Controllers.ExternalMergeEditor = Backbone.Controller.extend(_.extend((function() {
|
||||
var appLang = 'en',
|
||||
var appLang = '{{DEFAULT_LANG}}',
|
||||
customization = undefined,
|
||||
targetApp = '',
|
||||
externalEditor = null;
|
||||
|
|
|
@ -7,6 +7,8 @@ define([
|
|||
], function () {
|
||||
'use strict';
|
||||
|
||||
!Common.UI && (Common.UI = {});
|
||||
|
||||
Common.UI.Themes = new (function(locale) {
|
||||
!locale && (locale = {});
|
||||
var themes_map = {
|
||||
|
|
|
@ -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,
|
||||
buttons: [],
|
||||
closable: false
|
||||
});
|
||||
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.<br>Please contact your Document Server administrator.'
|
||||
}
|
||||
})(), DE.Controllers.Main || {}))
|
||||
});
|
|
@ -1520,7 +1520,7 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this,arguments);
|
||||
|
||||
this.menu = options.menu;
|
||||
this.urlPref = 'resources/help/en/';
|
||||
this.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
this.openUrl = null;
|
||||
|
||||
this.en_data = [
|
||||
|
@ -1638,12 +1638,12 @@ define([
|
|||
var config = {
|
||||
dataType: 'json',
|
||||
error: function () {
|
||||
if ( me.urlPref.indexOf('resources/help/en/')<0 ) {
|
||||
me.urlPref = 'resources/help/en/';
|
||||
store.url = 'resources/help/en/Contents.json';
|
||||
if ( me.urlPref.indexOf('resources/help/{{DEFAULT_LANG}}/')<0 ) {
|
||||
me.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
store.url = 'resources/help/{{DEFAULT_LANG}}/Contents.json';
|
||||
store.fetch(config);
|
||||
} else {
|
||||
me.urlPref = 'resources/help/en/';
|
||||
me.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
store.reset(me.en_data);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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.modal({
|
||||
title : this.notcriticalErrorTitle,
|
||||
text : this.errorLang
|
||||
});
|
||||
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.<br>Please contact your Document Server administrator.'
|
||||
}
|
||||
})(), DE.Controllers.Main || {}))
|
||||
});
|
|
@ -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,
|
||||
buttons: [],
|
||||
closable: false
|
||||
});
|
||||
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.<br>Please contact your Document Server administrator.'
|
||||
}
|
||||
})(), PE.Controllers.Main || {}))
|
||||
});
|
||||
|
|
|
@ -1321,7 +1321,7 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this,arguments);
|
||||
|
||||
this.menu = options.menu;
|
||||
this.urlPref = 'resources/help/en/';
|
||||
this.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
|
||||
this.en_data = [
|
||||
{"src": "ProgramInterface/ProgramInterface.htm", "name": "Introducing Presentation Editor user interface", "headername": "Program Interface"},
|
||||
|
@ -1421,12 +1421,12 @@ define([
|
|||
var config = {
|
||||
dataType: 'json',
|
||||
error: function () {
|
||||
if ( me.urlPref.indexOf('resources/help/en/')<0 ) {
|
||||
me.urlPref = 'resources/help/en/';
|
||||
store.url = 'resources/help/en/Contents.json';
|
||||
if ( me.urlPref.indexOf('resources/help/{{DEFAULT_LANG}}/')<0 ) {
|
||||
me.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
store.url = 'resources/help/{{DEFAULT_LANG}}/Contents.json';
|
||||
store.fetch(config);
|
||||
} else {
|
||||
me.urlPref = 'resources/help/en/';
|
||||
me.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
store.reset(me.en_data);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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.modal({
|
||||
title : this.notcriticalErrorTitle,
|
||||
text : this.errorLang
|
||||
});
|
||||
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.<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.',
|
||||
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 || {}))
|
||||
});
|
|
@ -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,
|
||||
buttons: [],
|
||||
closable: false
|
||||
});
|
||||
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.<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.',
|
||||
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 || {}))
|
||||
});
|
||||
|
|
|
@ -2176,7 +2176,7 @@ define([
|
|||
Common.UI.BaseView.prototype.initialize.call(this,arguments);
|
||||
|
||||
this.menu = options.menu;
|
||||
this.urlPref = 'resources/help/en/';
|
||||
this.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
|
||||
this.en_data = [
|
||||
{"src": "ProgramInterface/ProgramInterface.htm", "name": "Introducing Spreadsheet Editor user interface", "headername": "Program Interface"},
|
||||
|
@ -2278,12 +2278,12 @@ define([
|
|||
var config = {
|
||||
dataType: 'json',
|
||||
error: function () {
|
||||
if ( me.urlPref.indexOf('resources/help/en/')<0 ) {
|
||||
me.urlPref = 'resources/help/en/';
|
||||
store.url = 'resources/help/en/Contents.json';
|
||||
if ( me.urlPref.indexOf('resources/help/{{DEFAULT_LANG}}/')<0 ) {
|
||||
me.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
store.url = 'resources/help/{{DEFAULT_LANG}}/Contents.json';
|
||||
store.fetch(config);
|
||||
} else {
|
||||
me.urlPref = 'resources/help/en/';
|
||||
me.urlPref = 'resources/help/{{DEFAULT_LANG}}/';
|
||||
store.reset(me.en_data);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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.modal({
|
||||
title : this.notcriticalErrorTitle,
|
||||
text : this.errorLang
|
||||
});
|
||||
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.<br>You have no access to document editing functionality.<br>Please contact your administrator.',
|
||||
textGuest: 'Guest',
|
||||
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 || {}))
|
||||
});
|
|
@ -66,6 +66,9 @@ module.exports = function(grunt) {
|
|||
}, {
|
||||
from: /\{\{HELP_URL\}\}/g,
|
||||
to: _encode(process.env.HELP_URL) || 'https://helpcenter.onlyoffice.com'
|
||||
}, {
|
||||
from: /\{\{DEFAULT_LANG\}\}/g,
|
||||
to: _encode(process.env.DEFAULT_LANG) || 'en'
|
||||
}];
|
||||
|
||||
var helpreplacements = [
|
||||
|
|
Loading…
Reference in a new issue