better effort for translation
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
define([
|
define([
|
||||||
|
'/common/messages.js',
|
||||||
'/customize/DecorateToolbar.js',
|
'/customize/DecorateToolbar.js',
|
||||||
'/common/cryptpad-common.js',
|
'/common/cryptpad-common.js',
|
||||||
'/bower_components/lil-uri/uri.min.js',
|
'/bower_components/lil-uri/uri.min.js',
|
||||||
'/customize/email.js',
|
'/customize/email.js',
|
||||||
'/bower_components/jquery/dist/jquery.min.js',
|
'/bower_components/jquery/dist/jquery.min.js',
|
||||||
], function (DecorateToolbar, Cryptpad, LilUri, Email) {
|
], function (Messages, DecorateToolbar, Cryptpad, LilUri, Email) {
|
||||||
var $ = window.$;
|
var $ = window.$;
|
||||||
|
|
||||||
var email = Email.makeScrambler(1);
|
var email = Email.makeScrambler(1);
|
||||||
@@ -88,14 +89,14 @@ define([
|
|||||||
'class': 'remove',
|
'class': 'remove',
|
||||||
title: "forget '"+shortTitle + "'"
|
title: "forget '"+shortTitle + "'"
|
||||||
}).text('✖').click(function () {
|
}).text('✖').click(function () {
|
||||||
Cryptpad.confirm(fixHTML("Are you sure you'd like to forget this pad (" + shortTitle + ")?"), function (yes) {
|
Cryptpad.confirm(Messages.forgetPrompt + ' (' + fixHTML(shortTitle) + ')', function (yes) {
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
forgetPad(pad.href);
|
forgetPad(pad.href);
|
||||||
$row.fadeOut(750, function () {
|
$row.fadeOut(750, function () {
|
||||||
$row.remove();
|
$row.remove();
|
||||||
if (!$table.find('tr').find('td').length) {
|
if (!$table.find('tr').find('td').length) {
|
||||||
$table.remove();
|
$table.remove();
|
||||||
$tryit.text("Try it out!");
|
$tryit.text(Messages.tryIt);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -120,7 +121,7 @@ define([
|
|||||||
}
|
}
|
||||||
if (hasRecent) {
|
if (hasRecent) {
|
||||||
$('table').attr('style', '');
|
$('table').attr('style', '');
|
||||||
$tryit.text('Your Recent pads (stored only in browser)');
|
$tryit.text(Messages.recentPads);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ define([
|
|||||||
if ($select && $select.val) { $select.val(mode); }
|
if ($select && $select.val) { $select.val(mode); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
editor.setValue(Messages.codeInitialState); // HERE
|
||||||
|
|
||||||
var setTheme = module.setTheme = (function () {
|
var setTheme = module.setTheme = (function () {
|
||||||
var path = './theme/';
|
var path = './theme/';
|
||||||
@@ -103,7 +104,7 @@ define([
|
|||||||
var exportText = module.exportText = function () {
|
var exportText = module.exportText = function () {
|
||||||
var text = editor.getValue();
|
var text = editor.getValue();
|
||||||
|
|
||||||
Cryptpad.prompt('What would you like to name your file?',
|
Cryptpad.prompt(Messages.exportPrompt,
|
||||||
document.title, function (filename) {
|
document.title, function (filename) {
|
||||||
if (filename === null) { return; }
|
if (filename === null) { return; }
|
||||||
var blob = new Blob([text], {
|
var blob = new Blob([text], {
|
||||||
@@ -169,7 +170,7 @@ define([
|
|||||||
var createChangeName = function(id, $container) {
|
var createChangeName = function(id, $container) {
|
||||||
var buttonElmt = $container.find('#'+id)[0];
|
var buttonElmt = $container.find('#'+id)[0];
|
||||||
buttonElmt.addEventListener("click", function() {
|
buttonElmt.addEventListener("click", function() {
|
||||||
Cryptpad.prompt("Change your name:", '', function (newName) {
|
Cryptpad.prompt(Messages.changeNamePrompt, '', function (newName) {
|
||||||
if (!(typeof(newName) === 'string' && newName.trim())) { return; }
|
if (!(typeof(newName) === 'string' && newName.trim())) { return; }
|
||||||
var myUserNameTemp = newName.trim();
|
var myUserNameTemp = newName.trim();
|
||||||
if(newName.trim().length > 32) {
|
if(newName.trim().length > 32) {
|
||||||
@@ -200,14 +201,14 @@ define([
|
|||||||
|
|
||||||
/* add an export button */
|
/* add an export button */
|
||||||
var $export = $('<button>')
|
var $export = $('<button>')
|
||||||
.text('EXPORT')
|
.text(Messages.exportButton)
|
||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.click(exportText);
|
.click(exportText);
|
||||||
$rightside.append($export);
|
$rightside.append($export);
|
||||||
|
|
||||||
/* add an import button */
|
/* add an import button */
|
||||||
var $import = $('<button>')
|
var $import = $('<button>')
|
||||||
.text('IMPORT')
|
.text(Messages.importButton)
|
||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.click(Cryptpad.importContent('text/plain', function (content, file) {
|
.click(Cryptpad.importContent('text/plain', function (content, file) {
|
||||||
var mime = CodeMirror.findModeByMIME(file.type);
|
var mime = CodeMirror.findModeByMIME(file.type);
|
||||||
@@ -233,13 +234,13 @@ define([
|
|||||||
id: 'name-pad'
|
id: 'name-pad'
|
||||||
})
|
})
|
||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.text('RENAME')
|
.text(Messages.renameButton)
|
||||||
.click(function () {
|
.click(function () {
|
||||||
Cryptpad.prompt("How would you like this pad to be titled?",
|
Cryptpad.prompt(Messages.renamePrompt,
|
||||||
Cryptpad.getPadTitle(), function (title, ev) {
|
Cryptpad.getPadTitle(), function (title, ev) {
|
||||||
if (title === null) { return; }
|
if (title === null) { return; }
|
||||||
if (Cryptpad.causesNamingConflict(title)) {
|
if (Cryptpad.causesNamingConflict(title)) {
|
||||||
Cryptpad.alert("Another pad already has that title");
|
Cryptpad.alert(Messages.renameConflict);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Cryptpad.setPadTitle(title);
|
Cryptpad.setPadTitle(title);
|
||||||
@@ -252,12 +253,11 @@ define([
|
|||||||
var $forgetPad = $('<button>', {
|
var $forgetPad = $('<button>', {
|
||||||
id: 'cryptpad-forget',
|
id: 'cryptpad-forget',
|
||||||
})
|
})
|
||||||
.text('FORGET')
|
.text(Messages.forgetButton)
|
||||||
.addClass('cryptpad-forget rightside-button')
|
.addClass('cryptpad-forget rightside-button')
|
||||||
.click(function () {
|
.click(function () {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
var question = "Clicking OK will remove the URL for this pad from localStorage, are you sure?";
|
Cryptpad.confirm(Messages.forgetPrompt, function (yes) {
|
||||||
Cryptpad.confirm(question, function (yes) {
|
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
Cryptpad.forgetPad(href);
|
Cryptpad.forgetPad(href);
|
||||||
document.title = window.location.hash.slice(1,9);
|
document.title = window.location.hash.slice(1,9);
|
||||||
@@ -354,7 +354,7 @@ define([
|
|||||||
// Update the user list (metadata) from the hyperjson
|
// Update the user list (metadata) from the hyperjson
|
||||||
//updateUserList(shjson);
|
//updateUserList(shjson);
|
||||||
|
|
||||||
editor.setValue(newDoc);
|
editor.setValue(newDoc || Messages.codeInitialState);
|
||||||
|
|
||||||
if (Visible.isSupported()) {
|
if (Visible.isSupported()) {
|
||||||
Visible.onChange(function (yes) {
|
Visible.onChange(function (yes) {
|
||||||
@@ -442,7 +442,7 @@ define([
|
|||||||
var onAbort = config.onAbort = function (info) {
|
var onAbort = config.onAbort = function (info) {
|
||||||
// inform of network disconnect
|
// inform of network disconnect
|
||||||
setEditable(false);
|
setEditable(false);
|
||||||
Cryptpad.alert("Network Connection Lost!");
|
Cryptpad.alert(Messages.disconnectAlert);
|
||||||
};
|
};
|
||||||
|
|
||||||
Cryptpad.styleAlerts();
|
Cryptpad.styleAlerts();
|
||||||
|
|||||||
@@ -168,6 +168,10 @@ define([
|
|||||||
return title;
|
return title;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var fixFileName = common.fixFileName = function (filename) {
|
||||||
|
return filename.replace(/ /g, '-').replace(/\//g, '_');
|
||||||
|
};
|
||||||
|
|
||||||
var causesNamingConflict = common.causesNamingConflict = function (title) {
|
var causesNamingConflict = common.causesNamingConflict = function (title) {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
return getRecentPads().some(function (pad) {
|
return getRecentPads().some(function (pad) {
|
||||||
|
|||||||
@@ -16,6 +16,28 @@ define(function () {
|
|||||||
out.reconnecting = 'Reconnecting...';
|
out.reconnecting = 'Reconnecting...';
|
||||||
out.lag = 'Lag';
|
out.lag = 'Lag';
|
||||||
|
|
||||||
|
out.importButton = 'IMPORT';
|
||||||
|
|
||||||
|
out.exportButton = 'EXPORT';
|
||||||
|
out.exportPrompt = 'What would you like to name your file?';
|
||||||
|
|
||||||
|
out.back = '⇐ Back';
|
||||||
|
|
||||||
|
out.changeNameButton = 'Change name';
|
||||||
|
out.changeNamePrompt = 'Change your name: ';
|
||||||
|
|
||||||
|
out.renameButton = 'RENAME';
|
||||||
|
out.renamePrompt = 'How would you like to title this pad?';
|
||||||
|
out.renameConflict = 'Another pad already has that title';
|
||||||
|
|
||||||
|
out.forgetButton = 'FORGET';
|
||||||
|
out.forgetPrompt = 'Clicking OK will remove the URL for this pad from localStorage, are you sure?';
|
||||||
|
|
||||||
|
out.disconnectAlert = 'Network connection lost!';
|
||||||
|
|
||||||
|
out.tryIt = 'Try it out!';
|
||||||
|
out.recentPads = 'Your recent pads (stored only in your browser)';
|
||||||
|
|
||||||
out.initialState = [
|
out.initialState = [
|
||||||
'<p>',
|
'<p>',
|
||||||
'This is <strong>CryptPad</strong>, the zero knowledge realtime collaborative editor.',
|
'This is <strong>CryptPad</strong>, the zero knowledge realtime collaborative editor.',
|
||||||
@@ -33,10 +55,10 @@ define(function () {
|
|||||||
|
|
||||||
out.codeInitialState = [
|
out.codeInitialState = [
|
||||||
'/*\n',
|
'/*\n',
|
||||||
'This is CryptPad, the zero knowledge realtime collaborative editor.\n',
|
' This is CryptPad, the zero knowledge realtime collaborative editor.\n',
|
||||||
'What you type here is encrypted so only people who have the link can access it.\n',
|
' What you type here is encrypted so only people who have the link can access it.\n',
|
||||||
'Even the server cannot see what you type.\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',
|
' What you see here, what you hear here, when you leave here, let it stay here.\n',
|
||||||
'*/'
|
'*/'
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ define([
|
|||||||
var $back = $('<div>', {
|
var $back = $('<div>', {
|
||||||
'class': BACK_CLS,
|
'class': BACK_CLS,
|
||||||
id: uid(),
|
id: uid(),
|
||||||
}).html('⇐ Back').click(function () {
|
}).html(Messages.back).click(function () {
|
||||||
window.location.href = '/';
|
window.location.href = '/';
|
||||||
});
|
});
|
||||||
$container.append($back);
|
$container.append($back);
|
||||||
@@ -128,7 +128,7 @@ define([
|
|||||||
var $button = $('<button>', {
|
var $button = $('<button>', {
|
||||||
id: buttonID,
|
id: buttonID,
|
||||||
'class': USERNAME_BUTTON_GROUP,
|
'class': USERNAME_BUTTON_GROUP,
|
||||||
}).text('Change name');
|
}).text(Messages.changeNameButton);
|
||||||
|
|
||||||
$(userList).append($button);
|
$(userList).append($button);
|
||||||
$button.after($span);
|
$button.after($span);
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ define([
|
|||||||
var createChangeName = function(id, $container) {
|
var createChangeName = function(id, $container) {
|
||||||
var buttonElmt = $container.find('#'+id)[0];
|
var buttonElmt = $container.find('#'+id)[0];
|
||||||
buttonElmt.addEventListener("click", function() {
|
buttonElmt.addEventListener("click", function() {
|
||||||
Cryptpad.prompt("Change your name:", '', function (newName) {
|
Cryptpad.prompt(Messages.changeNamePrompt, '', function (newName) {
|
||||||
if (!(typeof(newName) === 'string' && newName.trim())) { return; }
|
if (!(typeof(newName) === 'string' && newName.trim())) { return; }
|
||||||
var myUserNameTemp = newName.trim();
|
var myUserNameTemp = newName.trim();
|
||||||
if(myUserNameTemp.length > 32) {
|
if(myUserNameTemp.length > 32) {
|
||||||
@@ -414,8 +414,8 @@ define([
|
|||||||
var exportFile = function () {
|
var exportFile = function () {
|
||||||
var html = getHTML();
|
var html = getHTML();
|
||||||
var suggestion = suggestName();
|
var suggestion = suggestName();
|
||||||
Cryptpad.prompt("What would you like to name your file?",
|
Cryptpad.prompt(Messages.exportPrompt,
|
||||||
suggestion.replace(/ /g, '-') + '.html', function (filename) {
|
Cryptpad.fixFileName(suggestion) + '.html', function (filename) {
|
||||||
if (!(typeof(filename) === 'string' && filename)) { return; }
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
||||||
var blob = new Blob([html], {type: "text/html;charset=utf-8"});
|
var blob = new Blob([html], {type: "text/html;charset=utf-8"});
|
||||||
saveAs(blob, filename);
|
saveAs(blob, filename);
|
||||||
@@ -436,13 +436,13 @@ define([
|
|||||||
|
|
||||||
/* add an export button */
|
/* add an export button */
|
||||||
var $export = $('<button>')
|
var $export = $('<button>')
|
||||||
.text('EXPORT')
|
.text(Messages.exportButton)
|
||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.click(exportFile);
|
.click(exportFile);
|
||||||
|
|
||||||
/* add an import button */
|
/* add an import button */
|
||||||
var $import = $('<button>')
|
var $import = $('<button>')
|
||||||
.text('IMPORT')
|
.text(Messages.importButton)
|
||||||
.addClass('rightside-button')
|
.addClass('rightside-button')
|
||||||
.click(Cryptpad.importContent('text/plain', function (content) {
|
.click(Cryptpad.importContent('text/plain', function (content) {
|
||||||
var shjson = stringify(Hyperjson.fromDOM(domFromHTML(content).body));
|
var shjson = stringify(Hyperjson.fromDOM(domFromHTML(content).body));
|
||||||
@@ -456,14 +456,14 @@ define([
|
|||||||
id: 'name-pad',
|
id: 'name-pad',
|
||||||
})
|
})
|
||||||
.addClass('cryptpad-rename rightside-button')
|
.addClass('cryptpad-rename rightside-button')
|
||||||
.text('RENAME')
|
.text(Messages.renameButton)
|
||||||
.click(function () {
|
.click(function () {
|
||||||
var suggestion = suggestName();
|
var suggestion = suggestName();
|
||||||
|
|
||||||
Cryptpad.prompt("How would you like to title this pad?", suggestion, function (title) {
|
Cryptpad.prompt(Messages.renamePrompt, suggestion, function (title) {
|
||||||
if (title === null) { return; }
|
if (title === null) { return; }
|
||||||
if (Cryptpad.causesNamingConflict(title)) {
|
if (Cryptpad.causesNamingConflict(title)) {
|
||||||
Cryptpad.alert("Another pad already has that title");
|
Cryptpad.alert(Messages.renameConflict);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,12 +477,11 @@ define([
|
|||||||
var $forgetPad = $('<button>', {
|
var $forgetPad = $('<button>', {
|
||||||
id: 'cryptpad-forget',
|
id: 'cryptpad-forget',
|
||||||
})
|
})
|
||||||
.text("FORGET")
|
.text(Messages.forgetButton)
|
||||||
.addClass('cryptpad-forget rightside-button')
|
.addClass('cryptpad-forget rightside-button')
|
||||||
.click(function () {
|
.click(function () {
|
||||||
var href = window.location.href;
|
var href = window.location.href;
|
||||||
var question = "Clicking OK will remove the URL for this pad from localStorage, are you sure?";
|
Cryptpad.confirm(Messages.forgetPrompt, function (yes) {
|
||||||
Cryptpad.confirm(question, function (yes) {
|
|
||||||
if (!yes) { return; }
|
if (!yes) { return; }
|
||||||
Cryptpad.forgetPad(href);
|
Cryptpad.forgetPad(href);
|
||||||
document.title = window.location.hash.slice(1,9);
|
document.title = window.location.hash.slice(1,9);
|
||||||
@@ -527,7 +526,7 @@ define([
|
|||||||
setEditable(false);
|
setEditable(false);
|
||||||
// TODO inform them that the session was torn down
|
// TODO inform them that the session was torn down
|
||||||
toolbar.failed();
|
toolbar.failed();
|
||||||
Cryptpad.alert("Network connection lost!");
|
Cryptpad.alert(Messages.disconnectAlert);
|
||||||
};
|
};
|
||||||
|
|
||||||
var onLocal = realtimeOptions.onLocal = function () {
|
var onLocal = realtimeOptions.onLocal = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user