From b01903202c3570f3af4788fe9b87a63846a0b914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Fri, 7 Dec 2012 05:24:40 +0100 Subject: [PATCH 1/4] Added new strings to translate for js files --- src/locales/en.ini | 16 ++++++++++++++++ src/locales/es.ini | 16 ++++++++++++++++ src/static/js/chat.js | 2 +- src/static/js/pad_editbar.js | 2 +- src/static/js/pad_impexp.js | 17 ++++++++++------- src/static/js/pad_savedrevs.js | 2 +- src/static/js/pad_userlist.js | 12 ++++++------ 7 files changed, 51 insertions(+), 16 deletions(-) diff --git a/src/locales/en.ini b/src/locales/en.ini index 82b429f8a..b5a19f9a4 100644 --- a/src/locales/en.ini +++ b/src/locales/en.ini @@ -94,3 +94,19 @@ timeslider.month.september = September timeslider.month.october = October timeslider.month.november = November timeslider.month.december = December +;js +pad_savedrevs.marked = This revision is now marked as a saved revision +pad_userlist.entername = Enter your name +pad_userlist.unnamed = unnamed +pad_userlist.guest = Guest +pad_userlist.deny = Deny +pad_userlist.approve = Approve +pad_editbar.clearcolors = Clear authorship colors on entire document? +pad_impexp.importbutton = Import Now +pad_impexp.importing = Importing... +pad_impexp.confirmimport = Importing a file will overwrite the current text of the pad. Are you sure you want to proceed? +pad_impexp.convertFailed = We were not able to import this file. Please use a different document format or copy paste manually +pad_impexp.uploadFailed = The upload failed, please try again +pad_impexp.importfailed = Import failed +pad_impexp.copypaste = Please copy paste +pad_impexp.exportdisabled = Exporting as {{type}} format is disabled. Please contact your system administrator for details. diff --git a/src/locales/es.ini b/src/locales/es.ini index ad8340136..626fa517c 100644 --- a/src/locales/es.ini +++ b/src/locales/es.ini @@ -95,3 +95,19 @@ timeslider.month.september = Septiembre timeslider.month.october = Octubre timeslider.month.november = Noviembre timeslider.month.december = Diciembre +;js +pad_savedrevs.marked = Revisión guardada +pad_userlist.entername = Escribe tu nombre +pad_userlist.unnamed = anónimo +pad_userlist.guest = Invitado +pad_userlist.deny = Denegar +pad_userlist.approve = Aprobar +pad_editbar.clearcolors = ¿Desea borrar el color de los autores en todo el documento? +pad_impexp.importbutton = Importar +pad_impexp.importing = Importando... +pad_impexp.confirmimport = Al importar un fichero se borrará el contenido actual del documento. ¿Quiere continuar? +pad_impexp.convertFailed = No pudimos importar este fichero. Intentalo con otro formato diferente o copia y pega manualmente. +pad_impexp.uploadFailed = El envío del fichero falló. Intentelo de nuevo. +pad_impexp.importfailed = Fallo al importar +pad_impexp.copypaste = Intente copiar y pegar +pad_impexp.exportdisabled = La exportación al formato {{type}} format está desactivada. Contacte con su administrador de sistemas. diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 4493ed154..225657c2e 100644 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -109,7 +109,7 @@ var chat = (function() } /* End of new action */ - var authorName = msg.userName == null ? "unnamed" : padutils.escapeHtml(msg.userName); + var authorName = msg.userName == null ? _('pad_userlist.unnamed') : padutils.escapeHtml(msg.userName); var html = "

" + authorName + ":" + timeStr + " " + text + "

"; $("#chattext").append(html); diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index 24dd3d6f0..f600ff098 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -169,7 +169,7 @@ var padeditbar = (function() { if ((!(ace.ace_getRep().selStart && ace.ace_getRep().selEnd)) || ace.ace_isCaret()) { - if (window.confirm("Clear authorship colors on entire document?")) + if (window.confirm(_("pad_editbar.clearcolors"))) { ace.ace_performDocumentApplyAttributesToCharRange(0, ace.ace_getRep().alltext.length, [ ['author', ''] diff --git a/src/static/js/pad_impexp.js b/src/static/js/pad_impexp.js index 4b4733a56..4fafd8847 100644 --- a/src/static/js/pad_impexp.js +++ b/src/static/js/pad_impexp.js @@ -69,7 +69,7 @@ var padimpexp = (function() function fileInputSubmit() { $('#importmessagefail').fadeOut("fast"); - var ret = window.confirm("Importing a file will overwrite the current text of the pad." + " Are you sure you want to proceed?"); + var ret = window.confirm(_("pad_impexp.confirmimport")); if (ret) { hidePanelCall = paddocbar.hideLaterIfNoOtherInteraction(); @@ -85,7 +85,7 @@ var padimpexp = (function() $('#importsubmitinput').attr( { disabled: true - }).val("Importing..."); + }).val(_("pad_impexp.importing")); window.setTimeout(function() { $('#importfileinput').attr( @@ -106,7 +106,7 @@ var padimpexp = (function() function importDone() { - $('#importsubmitinput').removeAttr('disabled').val("Import Now"); + $('#importsubmitinput').removeAttr('disabled').val(_("pad_impexp.importbutton")); window.setTimeout(function() { $('#importfileinput').removeAttr('disabled'); @@ -130,14 +130,14 @@ var padimpexp = (function() var msg=""; if(status === "convertFailed"){ - msg = "We were not able to import this file. Please use a different document format or copy paste manually"; + msg = _("pad_impexp.convertFailed"); } else if(status === "uploadFailed"){ - msg = "The upload failed, please try again"; + msg = _("pad_impexp.uploadFailed"); } function showError(fade) { - $('#importmessagefail').html('Import failed: ' + (msg || 'Please copy paste'))[(fade ? "fadeIn" : "show")](); + $('#importmessagefail').html(''+_('pad_impexp.importfailed')+': ' + (msg || _('pad_impexp.copypaste','')))[(fade ? "fadeIn" : "show")](); } if ($('#importexport .importmessage').is(':visible')) @@ -198,7 +198,7 @@ var padimpexp = (function() { type = "this file"; } - alert("Exporting as " + type + " format is disabled. Please contact your" + " system administrator for details."); + alert(_("pad_impexp.exportdisabled", {type:type})); return false; } @@ -214,6 +214,9 @@ var padimpexp = (function() //get http://example.com/p/padname var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path) + //i10l buttom import + $('#importsubmitinput').val(_("pad_impexp.importbutton")); + // build the export links $("#exporthtmla").attr("href", pad_root_path + "/export/html"); $("#exportplaina").attr("href", pad_root_path + "/export/txt"); diff --git a/src/static/js/pad_savedrevs.js b/src/static/js/pad_savedrevs.js index bf4f941c0..14fa1b6e8 100644 --- a/src/static/js/pad_savedrevs.js +++ b/src/static/js/pad_savedrevs.js @@ -18,7 +18,7 @@ var pad; exports.saveNow = function(){ pad.collabClient.sendMessage({"type": "SAVE_REVISION"}); - alert("This revision is now marked as a saved revision"); + alert(_("pad_savedrevs.marked")); } exports.init = function(_pad){ diff --git a/src/static/js/pad_userlist.js b/src/static/js/pad_userlist.js index 474f9b0e1..fe0179129 100644 --- a/src/static/js/pad_userlist.js +++ b/src/static/js/pad_userlist.js @@ -113,12 +113,12 @@ var paduserlist = (function() nameHtml = padutils.escapeHtml(data.name); if (isGuest && pad.getIsProPad()) { - nameHtml += ' (Guest)'; + nameHtml += ' ('+_(pad_userlist.guest)+')'; } } else { - nameHtml = ''; + nameHtml = ''; } return ['
 
', '', nameHtml, '', '', padutils.escapeHtml(data.activity), ''].join(''); @@ -374,7 +374,7 @@ var paduserlist = (function() if (!newName) { jnode.addClass("editempty"); - jnode.val("unnamed"); + jnode.val(_('pad_userlist.unnamed')); } else { @@ -662,13 +662,13 @@ var paduserlist = (function() if (box.length == 0) { // make guest prompt box - box = $('
Guest: ' + padutils.escapeHtml(displayName) + '
'); + box = $('
'+_('pad_userlist.guest')+': ' + padutils.escapeHtml(displayName) + '
'); $("#guestprompts").append(box); } else { // update display name - box.find(".guestname").html('Guest: ' + padutils.escapeHtml(displayName)); + box.find(".guestname").html(''+_('pad_userlist.guest')+': ' + padutils.escapeHtml(displayName)); } var hideLater = padutils.getCancellableAction(actionName, function() { @@ -715,7 +715,7 @@ var paduserlist = (function() } else { - $("#myusernameedit").addClass("editempty").val("Enter your name"); + $("#myusernameedit").addClass("editempty").val(_("pad_userlist.entername")); } if (colorPickerOpen) { From 9f1872afc191e58406cf78fd101f6d057c4e4759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Sun, 9 Dec 2012 08:56:58 +0100 Subject: [PATCH 2/4] use properties notation --- src/locales/en.ini | 30 +++++++++++++++--------------- src/locales/es.ini | 30 +++++++++++++++--------------- src/static/js/chat.js | 2 +- src/static/js/pad_editbar.js | 2 +- src/static/js/pad_impexp.js | 16 ++++++++-------- src/static/js/pad_savedrevs.js | 2 +- src/static/js/pad_userlist.js | 12 ++++++------ 7 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/locales/en.ini b/src/locales/en.ini index b5a19f9a4..3d78f67cb 100644 --- a/src/locales/en.ini +++ b/src/locales/en.ini @@ -95,18 +95,18 @@ timeslider.month.october = October timeslider.month.november = November timeslider.month.december = December ;js -pad_savedrevs.marked = This revision is now marked as a saved revision -pad_userlist.entername = Enter your name -pad_userlist.unnamed = unnamed -pad_userlist.guest = Guest -pad_userlist.deny = Deny -pad_userlist.approve = Approve -pad_editbar.clearcolors = Clear authorship colors on entire document? -pad_impexp.importbutton = Import Now -pad_impexp.importing = Importing... -pad_impexp.confirmimport = Importing a file will overwrite the current text of the pad. Are you sure you want to proceed? -pad_impexp.convertFailed = We were not able to import this file. Please use a different document format or copy paste manually -pad_impexp.uploadFailed = The upload failed, please try again -pad_impexp.importfailed = Import failed -pad_impexp.copypaste = Please copy paste -pad_impexp.exportdisabled = Exporting as {{type}} format is disabled. Please contact your system administrator for details. +pad.savedrevs.marked = This revision is now marked as a saved revision +pad.userlist.entername = Enter your name +pad.userlist.unnamed = unnamed +pad.userlist.guest = Guest +pad.userlist.deny = Deny +pad.userlist.approve = Approve +pad.editbar.clearcolors = Clear authorship colors on entire document? +pad.impexp.importbutton = Import Now +pad.impexp.importing = Importing... +pad.impexp.confirmimport = Importing a file will overwrite the current text of the pad. Are you sure you want to proceed? +pad.impexp.convertFailed = We were not able to import this file. Please use a different document format or copy paste manually +pad.impexp.uploadFailed = The upload failed, please try again +pad.impexp.importfailed = Import failed +pad.impexp.copypaste = Please copy paste +pad.impexp.exportdisabled = Exporting as {{type}} format is disabled. Please contact your system administrator for details. diff --git a/src/locales/es.ini b/src/locales/es.ini index f4295a24e..59038ab06 100644 --- a/src/locales/es.ini +++ b/src/locales/es.ini @@ -96,18 +96,18 @@ timeslider.month.october = Octubre timeslider.month.november = Noviembre timeslider.month.december = Diciembre ;js -pad_savedrevs.marked = Revisión guardada -pad_userlist.entername = Escribe tu nombre -pad_userlist.unnamed = anónimo -pad_userlist.guest = Invitado -pad_userlist.deny = Denegar -pad_userlist.approve = Aprobar -pad_editbar.clearcolors = ¿Desea borrar el color de los autores en todo el documento? -pad_impexp.importbutton = Importar -pad_impexp.importing = Importando... -pad_impexp.confirmimport = Al importar un fichero se borrará el contenido actual del documento. ¿Quiere continuar? -pad_impexp.convertFailed = No pudimos importar este fichero. Intentalo con otro formato diferente o copia y pega manualmente. -pad_impexp.uploadFailed = El envío del fichero falló. Intentelo de nuevo. -pad_impexp.importfailed = Fallo al importar -pad_impexp.copypaste = Intente copiar y pegar -pad_impexp.exportdisabled = La exportación al formato {{type}} format está desactivada. Contacte con su administrador de sistemas. +pad.savedrevs.marked = Revisión guardada +pad.userlist.entername = Escribe tu nombre +pad.userlist.unnamed = anónimo +pad.userlist.guest = Invitado +pad.userlist.deny = Denegar +pad.userlist.approve = Aprobar +pad.editbar.clearcolors = ¿Desea borrar el color de los autores en todo el documento? +pad.impexp.importbutton = Importar +pad.impexp.importing = Importando... +pad.impexp.confirmimport = Al importar un fichero se borrará el contenido actual del documento. ¿Quiere continuar? +pad.impexp.convertFailed = No pudimos importar este fichero. Intentalo con otro formato diferente o copia y pega manualmente. +pad.impexp.uploadFailed = El envío del fichero falló. Intentelo de nuevo. +pad.impexp.importfailed = Fallo al importar +pad.impexp.copypaste = Intente copiar y pegar +pad.impexp.exportdisabled = La exportación al formato {{type}} format está desactivada. Contacte con su administrador de sistemas. diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 225657c2e..79224e80c 100644 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -109,7 +109,7 @@ var chat = (function() } /* End of new action */ - var authorName = msg.userName == null ? _('pad_userlist.unnamed') : padutils.escapeHtml(msg.userName); + var authorName = msg.userName == null ? _('pad.userlist.unnamed') : padutils.escapeHtml(msg.userName); var html = "

" + authorName + ":" + timeStr + " " + text + "

"; $("#chattext").append(html); diff --git a/src/static/js/pad_editbar.js b/src/static/js/pad_editbar.js index f600ff098..6a7f6ee16 100644 --- a/src/static/js/pad_editbar.js +++ b/src/static/js/pad_editbar.js @@ -169,7 +169,7 @@ var padeditbar = (function() { if ((!(ace.ace_getRep().selStart && ace.ace_getRep().selEnd)) || ace.ace_isCaret()) { - if (window.confirm(_("pad_editbar.clearcolors"))) + if (window.confirm(_("pad.editbar.clearcolors"))) { ace.ace_performDocumentApplyAttributesToCharRange(0, ace.ace_getRep().alltext.length, [ ['author', ''] diff --git a/src/static/js/pad_impexp.js b/src/static/js/pad_impexp.js index 4fafd8847..0199b346a 100644 --- a/src/static/js/pad_impexp.js +++ b/src/static/js/pad_impexp.js @@ -69,7 +69,7 @@ var padimpexp = (function() function fileInputSubmit() { $('#importmessagefail').fadeOut("fast"); - var ret = window.confirm(_("pad_impexp.confirmimport")); + var ret = window.confirm(_("pad.impexp.confirmimport")); if (ret) { hidePanelCall = paddocbar.hideLaterIfNoOtherInteraction(); @@ -85,7 +85,7 @@ var padimpexp = (function() $('#importsubmitinput').attr( { disabled: true - }).val(_("pad_impexp.importing")); + }).val(_("pad.impexp.importing")); window.setTimeout(function() { $('#importfileinput').attr( @@ -106,7 +106,7 @@ var padimpexp = (function() function importDone() { - $('#importsubmitinput').removeAttr('disabled').val(_("pad_impexp.importbutton")); + $('#importsubmitinput').removeAttr('disabled').val(_("pad.impexp.importbutton")); window.setTimeout(function() { $('#importfileinput').removeAttr('disabled'); @@ -130,14 +130,14 @@ var padimpexp = (function() var msg=""; if(status === "convertFailed"){ - msg = _("pad_impexp.convertFailed"); + msg = _("pad.impexp.convertFailed"); } else if(status === "uploadFailed"){ - msg = _("pad_impexp.uploadFailed"); + msg = _("pad.impexp.uploadFailed"); } function showError(fade) { - $('#importmessagefail').html(''+_('pad_impexp.importfailed')+': ' + (msg || _('pad_impexp.copypaste','')))[(fade ? "fadeIn" : "show")](); + $('#importmessagefail').html(''+_('pad.impexp.importfailed')+': ' + (msg || _('pad.impexp.copypaste','')))[(fade ? "fadeIn" : "show")](); } if ($('#importexport .importmessage').is(':visible')) @@ -198,7 +198,7 @@ var padimpexp = (function() { type = "this file"; } - alert(_("pad_impexp.exportdisabled", {type:type})); + alert(_("pad.impexp.exportdisabled", {type:type})); return false; } @@ -215,7 +215,7 @@ var padimpexp = (function() var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path) //i10l buttom import - $('#importsubmitinput').val(_("pad_impexp.importbutton")); + $('#importsubmitinput').val(_("pad.impexp.importbutton")); // build the export links $("#exporthtmla").attr("href", pad_root_path + "/export/html"); diff --git a/src/static/js/pad_savedrevs.js b/src/static/js/pad_savedrevs.js index 14fa1b6e8..e1552c27c 100644 --- a/src/static/js/pad_savedrevs.js +++ b/src/static/js/pad_savedrevs.js @@ -18,7 +18,7 @@ var pad; exports.saveNow = function(){ pad.collabClient.sendMessage({"type": "SAVE_REVISION"}); - alert(_("pad_savedrevs.marked")); + alert(_("pad.savedrevs.marked")); } exports.init = function(_pad){ diff --git a/src/static/js/pad_userlist.js b/src/static/js/pad_userlist.js index fe0179129..40e87a4f7 100644 --- a/src/static/js/pad_userlist.js +++ b/src/static/js/pad_userlist.js @@ -113,12 +113,12 @@ var paduserlist = (function() nameHtml = padutils.escapeHtml(data.name); if (isGuest && pad.getIsProPad()) { - nameHtml += ' ('+_(pad_userlist.guest)+')'; + nameHtml += ' ('+_(pad.userlist.guest)+')'; } } else { - nameHtml = ''; + nameHtml = ''; } return ['
 
', '', nameHtml, '', '', padutils.escapeHtml(data.activity), ''].join(''); @@ -374,7 +374,7 @@ var paduserlist = (function() if (!newName) { jnode.addClass("editempty"); - jnode.val(_('pad_userlist.unnamed')); + jnode.val(_('pad.userlist.unnamed')); } else { @@ -662,13 +662,13 @@ var paduserlist = (function() if (box.length == 0) { // make guest prompt box - box = $('
'+_('pad_userlist.guest')+': ' + padutils.escapeHtml(displayName) + '
'); + box = $('
'+_('pad.userlist.guest')+': ' + padutils.escapeHtml(displayName) + '
'); $("#guestprompts").append(box); } else { // update display name - box.find(".guestname").html(''+_('pad_userlist.guest')+': ' + padutils.escapeHtml(displayName)); + box.find(".guestname").html(''+_('pad.userlist.guest')+': ' + padutils.escapeHtml(displayName)); } var hideLater = padutils.getCancellableAction(actionName, function() { @@ -715,7 +715,7 @@ var paduserlist = (function() } else { - $("#myusernameedit").addClass("editempty").val(_("pad_userlist.entername")); + $("#myusernameedit").addClass("editempty").val(_("pad.userlist.entername")); } if (colorPickerOpen) { From 0371d5ba9e3058a8e048e89d4a649191edbd842e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Sun, 9 Dec 2012 09:41:30 +0100 Subject: [PATCH 3/4] Remove async load of l10n.js because Chrome fail to translate --- src/templates/pad.html | 2 +- src/templates/timeslider.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates/pad.html b/src/templates/pad.html index ba4e777a7..6232751f4 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -42,7 +42,7 @@ if(language) document.documentElement.lang = language[1]; })(); - + <% e.begin_block("styles"); %> diff --git a/src/templates/timeslider.html b/src/templates/timeslider.html index 281fa01b9..a3e94118c 100644 --- a/src/templates/timeslider.html +++ b/src/templates/timeslider.html @@ -41,7 +41,7 @@ if(language) document.documentElement.lang = language[1]; })(); - + From ff8b4b6b207d2b2732b356bb7365579555f00db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Sun, 9 Dec 2012 17:34:32 +0100 Subject: [PATCH 4/4] change key of message sucessfull on import --- src/locales/en.ini | 2 +- src/templates/pad.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/locales/en.ini b/src/locales/en.ini index 3d78f67cb..1e8c0fd59 100644 --- a/src/locales/en.ini +++ b/src/locales/en.ini @@ -36,7 +36,7 @@ pad.settings.globalView = Global View pad.settings.language = Language: pad.importExport.import_export = Import/Export pad.importExport.import = Upload any text file or document -pad.importExport.successful = Successful! +pad.importExport.importSuccessful = Successful! pad.importExport.export = Export current pad as: pad.importExport.exporthtml = HTML pad.importExport.exportplain = Plain text diff --git a/src/templates/pad.html b/src/templates/pad.html index 6232751f4..804c2e807 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -266,7 +266,7 @@
-
+