Added options to choose Polish language
parent
0b459890fd
commit
f6f1bc09bb
@ -1,126 +1,127 @@
|
|||||||
define(['/customize/languageSelector.js',
|
define(['/customize/languageSelector.js',
|
||||||
'/customize/translations/messages.js',
|
'/customize/translations/messages.js',
|
||||||
'/customize/translations/messages.es.js',
|
'/customize/translations/messages.es.js',
|
||||||
'/customize/translations/messages.fr.js',
|
'/customize/translations/messages.fr.js',
|
||||||
|
|
||||||
// 1) additional translation files can be added here...
|
// 1) additional translation files can be added here...
|
||||||
|
'/customize/translations/messages.pl.js',
|
||||||
'/bower_components/jquery/dist/jquery.min.js'],
|
'/bower_components/jquery/dist/jquery.min.js'],
|
||||||
|
|
||||||
// 2) name your language module here...
|
// 2) name your language module here...
|
||||||
function(LS, Default, Spanish, French) {
|
function(LS, Default, Spanish, French, Polish) {
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
|
|
||||||
// 3) add your module to this map so it gets used
|
// 3) add your module to this map so it gets used
|
||||||
var map = {
|
var map = {
|
||||||
'fr': French,
|
'fr': French,
|
||||||
'es': Spanish,
|
'es': Spanish,
|
||||||
};
|
'pl': Polish,
|
||||||
|
};
|
||||||
var defaultLanguage = 'en';
|
|
||||||
|
var defaultLanguage = 'en';
|
||||||
var language = LS.getLanguage();
|
|
||||||
|
var language = LS.getLanguage();
|
||||||
var messages;
|
|
||||||
|
var messages;
|
||||||
if (!language || language === defaultLanguage || language === 'default' || !map[language]) {
|
|
||||||
messages = Default;
|
if (!language || language === defaultLanguage || language === 'default' || !map[language]) {
|
||||||
}
|
messages = Default;
|
||||||
else {
|
}
|
||||||
// Add the translated keys to the returned object
|
else {
|
||||||
messages = $.extend(true, {}, Default, map[language]);
|
// Add the translated keys to the returned object
|
||||||
}
|
messages = $.extend(true, {}, Default, map[language]);
|
||||||
|
}
|
||||||
// messages_languages return the available translations and their name in an object :
|
|
||||||
// { "en": "English", "fr": "French", ... }
|
// messages_languages return the available translations and their name in an object :
|
||||||
messages._languages = {
|
// { "en": "English", "fr": "French", ... }
|
||||||
'en': Default._languageName
|
messages._languages = {
|
||||||
};
|
'en': Default._languageName
|
||||||
for (var l in map) {
|
};
|
||||||
messages._languages[l] = map[l]._languageName || l;
|
for (var l in map) {
|
||||||
}
|
messages._languages[l] = map[l]._languageName || l;
|
||||||
|
}
|
||||||
messages._initSelector = LS.main;
|
|
||||||
messages._checkTranslationState = function () {
|
messages._initSelector = LS.main;
|
||||||
var missing = [];
|
messages._checkTranslationState = function () {
|
||||||
Object.keys(map).forEach(function (code) {
|
var missing = [];
|
||||||
var translation = map[code];
|
Object.keys(map).forEach(function (code) {
|
||||||
Object.keys(Default).forEach(function (k) {
|
var translation = map[code];
|
||||||
if (/^_/.test(k) || /nitialState$/.test(k)) { return; }
|
Object.keys(Default).forEach(function (k) {
|
||||||
if (!translation[k]) {
|
if (/^_/.test(k) || /nitialState$/.test(k)) { return; }
|
||||||
var warning = "key [" + k + "] is missing from translation [" + code + "]";
|
if (!translation[k]) {
|
||||||
missing.push(warning);
|
var warning = "key [" + k + "] is missing from translation [" + code + "]";
|
||||||
}
|
missing.push(warning);
|
||||||
});
|
}
|
||||||
if (typeof(translation._languageName) !== 'string') {
|
});
|
||||||
var warning = 'key [_languageName] is missing from translation [' + code + ']';
|
if (typeof(translation._languageName) !== 'string') {
|
||||||
missing.push(warning);
|
var warning = 'key [_languageName] is missing from translation [' + code + ']';
|
||||||
}
|
missing.push(warning);
|
||||||
});
|
}
|
||||||
return missing;
|
});
|
||||||
};
|
return missing;
|
||||||
|
};
|
||||||
// Get keys with parameters
|
|
||||||
messages._getKey = function (key, argArray) {
|
// Get keys with parameters
|
||||||
if (!messages[key]) { return '?'; }
|
messages._getKey = function (key, argArray) {
|
||||||
var text = messages[key];
|
if (!messages[key]) { return '?'; }
|
||||||
return text.replace(/\{(\d+)\}/g, function (str, p1) {
|
var text = messages[key];
|
||||||
return argArray[p1] || null;
|
return text.replace(/\{(\d+)\}/g, function (str, p1) {
|
||||||
});
|
return argArray[p1] || null;
|
||||||
};
|
});
|
||||||
|
};
|
||||||
messages._applyTranslation = function () {
|
|
||||||
$('[data-localization]').each(function (i, e) {
|
messages._applyTranslation = function () {
|
||||||
var $el = $(this);
|
$('[data-localization]').each(function (i, e) {
|
||||||
var key = $el.data('localization');
|
var $el = $(this);
|
||||||
$el.html(messages[key]);
|
var key = $el.data('localization');
|
||||||
});
|
$el.html(messages[key]);
|
||||||
$('[data-localization-title]').each(function (i, e) {
|
});
|
||||||
var $el = $(this);
|
$('[data-localization-title]').each(function (i, e) {
|
||||||
var key = $el.data('localization-title');
|
var $el = $(this);
|
||||||
$el.attr('title', messages[key]);
|
var key = $el.data('localization-title');
|
||||||
});
|
$el.attr('title', messages[key]);
|
||||||
};
|
});
|
||||||
|
};
|
||||||
// Non translatable keys
|
|
||||||
messages.initialState = [
|
// Non translatable keys
|
||||||
'<p>',
|
messages.initialState = [
|
||||||
'This is <strong>CryptPad</strong>, the zero knowledge realtime collaborative editor.',
|
'<p>',
|
||||||
'<br>',
|
'This is <strong>CryptPad</strong>, the zero knowledge realtime collaborative editor.',
|
||||||
'What you type here is encrypted so only people who have the link can access it.',
|
'<br>',
|
||||||
'<br>',
|
'What you type here is encrypted so only people who have the link can access it.',
|
||||||
'Even the server cannot see what you type.',
|
'<br>',
|
||||||
'</p>',
|
'Even the server cannot see what you type.',
|
||||||
'<p>',
|
'</p>',
|
||||||
'<small>',
|
'<p>',
|
||||||
'<i>What you see here, what you hear here, when you leave here, let it stay here</i>',
|
'<small>',
|
||||||
'</small>',
|
'<i>What you see here, what you hear here, when you leave here, let it stay here</i>',
|
||||||
'</p>',
|
'</small>',
|
||||||
].join('');
|
'</p>',
|
||||||
|
].join('');
|
||||||
messages.codeInitialState = [
|
|
||||||
'/*\n',
|
messages.codeInitialState = [
|
||||||
' This is CryptPad, the zero knowledge realtime collaborative editor.\n',
|
'/*\n',
|
||||||
' What you type here is encrypted so only people who have the link can access it.\n',
|
' This is CryptPad, the zero knowledge realtime collaborative editor.\n',
|
||||||
' Even the server cannot see what you type.\n',
|
' What you type here is encrypted so only people who have the link can access it.\n',
|
||||||
' What you see here, what you hear here, when you leave here, let it stay here.\n',
|
' Even the server cannot see what you type.\n',
|
||||||
'*/'
|
' What you see here, what you hear here, when you leave here, let it stay here.\n',
|
||||||
].join('');
|
'*/'
|
||||||
|
].join('');
|
||||||
messages.slideInitialState = [
|
|
||||||
'# CryptSlide\n',
|
messages.slideInitialState = [
|
||||||
'* This is a zero knowledge realtime collaborative editor.\n',
|
'# CryptSlide\n',
|
||||||
'* What you type here is encrypted so only people who have the link can access it.\n',
|
'* This is a zero knowledge realtime collaborative editor.\n',
|
||||||
'* Even the server cannot see what you type.\n',
|
'* What you type here is encrypted so only people who have the link can access it.\n',
|
||||||
'* What you see here, what you hear here, when you leave here, let it stay here.\n',
|
'* Even the server cannot see what you type.\n',
|
||||||
'\n',
|
'* What you see here, what you hear here, when you leave here, let it stay here.\n',
|
||||||
'---',
|
'\n',
|
||||||
'\n',
|
'---',
|
||||||
'# How to use\n',
|
'\n',
|
||||||
'1. Write your slides content using markdown syntax\n',
|
'# How to use\n',
|
||||||
'2. Separate your slides with ---\n',
|
'1. Write your slides content using markdown syntax\n',
|
||||||
'3. Click on the "Play" button to see the result'
|
'2. Separate your slides with ---\n',
|
||||||
].join('');
|
'3. Click on the "Play" button to see the result'
|
||||||
|
].join('');
|
||||||
return messages;
|
|
||||||
});
|
return messages;
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue