mirror of https://github.com/xwiki-labs/cryptpad
Make the list of available languages for CryptPad configurable
This commit is contained in:
parent
fc3cb27fb8
commit
c75e4035b6
|
@ -43,13 +43,31 @@ require.config({
|
|||
}
|
||||
});
|
||||
|
||||
var req = ['/common/common-util.js', '/customize/translations/messages.js'];
|
||||
var req = [
|
||||
'/common/common-util.js',
|
||||
'/customize/application_config.js',
|
||||
'/customize/translations/messages.js'
|
||||
];
|
||||
if (language && map[language]) { req.push('/customize/translations/messages.' + language + '.js'); }
|
||||
|
||||
define(req, function(Util, Default, Language) {
|
||||
define(req, function(Util, AppConfig, Default, Language) {
|
||||
map.en = 'English';
|
||||
var defaultLanguage = 'en';
|
||||
|
||||
if (AppConfig.availableLanguages) {
|
||||
if (AppConfig.availableLanguages.indexOf(language) === -1) {
|
||||
language = defaultLanguage;
|
||||
Language = Default;
|
||||
localStorage.setItem(LS_LANG, language);
|
||||
}
|
||||
Object.keys(map).forEach(function (l) {
|
||||
if (l === defaultLanguage) { return; }
|
||||
if (AppConfig.availableLanguages.indexOf(l) === -1) {
|
||||
delete map[l];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Util.extend(messages, Default);
|
||||
if (Language && language !== defaultLanguage) {
|
||||
// Add the translated keys to the returned object
|
||||
|
|
|
@ -22,13 +22,23 @@ define(function() {
|
|||
*/
|
||||
config.registeredOnlyTypes = ['file', 'contacts', 'oodoc', 'ooslide', 'sheet'];
|
||||
|
||||
/* CryptPad is available is multiple languages, but only English and French are maintained
|
||||
* by the developers. The other languages may be outdated, and any missing string for a langauge
|
||||
* will use the english version instead. You can customize the langauges you want to be available
|
||||
* on your instance by removing them from the following list.
|
||||
* An empty list will load all available languages for CryptPad. The list of available languages
|
||||
* can be found at the top of the file `/customize.dist/messages.js`. The list should only
|
||||
* contain languages code ('en', 'fr', 'de', 'pt-br', etc.), not their full name.
|
||||
*/
|
||||
//config.availableLanguages = ['en', 'fr', 'de'];
|
||||
|
||||
|
||||
/* Cryptpad apps use a common API to display notifications to users
|
||||
* by default, notifications are hidden after 5 seconds
|
||||
* You can change their duration here (measured in milliseconds)
|
||||
*/
|
||||
config.notificationTimeout = 5000;
|
||||
config.disableUserlistNotifications = false;
|
||||
config.hideLoadingScreenTips = false;
|
||||
|
||||
config.enablePinning = true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue