Fix html10n usage in code that wouldn't allow lang switching

This commit is contained in:
Marcel Klehr 2012-12-20 11:19:51 +01:00
parent 580d936e50
commit 0c9178d392
3 changed files with 14 additions and 9 deletions

View file

@ -169,7 +169,7 @@ var padeditbar = (function()
{ {
if ((!(ace.ace_getRep().selStart && ace.ace_getRep().selEnd)) || ace.ace_isCaret()) if ((!(ace.ace_getRep().selStart && ace.ace_getRep().selEnd)) || ace.ace_isCaret())
{ {
if (window.confirm(_("pad.editbar.clearcolors"))) if (window.confirm(html10n.get("pad.editbar.clearcolors")))
{ {
ace.ace_performDocumentApplyAttributesToCharRange(0, ace.ace_getRep().alltext.length, [ ace.ace_performDocumentApplyAttributesToCharRange(0, ace.ace_getRep().alltext.length, [
['author', ''] ['author', '']

View file

@ -79,6 +79,7 @@ var padeditor = (function()
html10n.bind('localized', function() { html10n.bind('localized', function() {
$("#languagemenu").val(html10n.getLanguage()); $("#languagemenu").val(html10n.getLanguage());
}) })
$("#languagemenu").val(html10n.getLanguage());
$("#languagemenu").change(function() { $("#languagemenu").change(function() {
pad.createCookie("language",$("#languagemenu").val(),null,'/'); pad.createCookie("language",$("#languagemenu").val(),null,'/');
window.html10n.localize([$("#languagemenu").val(), 'en']); window.html10n.localize([$("#languagemenu").val(), 'en']);

View file

@ -69,7 +69,7 @@ var padimpexp = (function()
function fileInputSubmit() function fileInputSubmit()
{ {
$('#importmessagefail').fadeOut("fast"); $('#importmessagefail').fadeOut("fast");
var ret = window.confirm(_("pad.impexp.confirmimport")); var ret = window.confirm(html10n.get("pad.impexp.confirmimport"));
if (ret) if (ret)
{ {
hidePanelCall = paddocbar.hideLaterIfNoOtherInteraction(); hidePanelCall = paddocbar.hideLaterIfNoOtherInteraction();
@ -85,7 +85,8 @@ var padimpexp = (function()
$('#importsubmitinput').attr( $('#importsubmitinput').attr(
{ {
disabled: true disabled: true
}).val(_("pad.impexp.importing")); }).val(html10n.get("pad.impexp.importing"));
window.setTimeout(function() window.setTimeout(function()
{ {
$('#importfileinput').attr( $('#importfileinput').attr(
@ -106,7 +107,7 @@ var padimpexp = (function()
function importDone() function importDone()
{ {
$('#importsubmitinput').removeAttr('disabled').val(_("pad.impexp.importbutton")); $('#importsubmitinput').removeAttr('disabled').val(html10n.get("pad.impexp.importbutton"));
window.setTimeout(function() window.setTimeout(function()
{ {
$('#importfileinput').removeAttr('disabled'); $('#importfileinput').removeAttr('disabled');
@ -130,14 +131,14 @@ var padimpexp = (function()
var msg=""; var msg="";
if(status === "convertFailed"){ if(status === "convertFailed"){
msg = _("pad.impexp.convertFailed"); msg = html10n.get("pad.impexp.convertFailed");
} else if(status === "uploadFailed"){ } else if(status === "uploadFailed"){
msg = _("pad.impexp.uploadFailed"); msg = html10n.get("pad.impexp.uploadFailed");
} }
function showError(fade) function showError(fade)
{ {
$('#importmessagefail').html('<strong style="color: red">'+_('pad.impexp.importfailed')+':</strong> ' + (msg || _('pad.impexp.copypaste','')))[(fade ? "fadeIn" : "show")](); $('#importmessagefail').html('<strong style="color: red">'+html10n.get('pad.impexp.importfailed')+':</strong> ' + (msg || html10n.get('pad.impexp.copypaste','')))[(fade ? "fadeIn" : "show")]();
} }
if ($('#importexport .importmessage').is(':visible')) if ($('#importexport .importmessage').is(':visible'))
@ -198,7 +199,7 @@ var padimpexp = (function()
{ {
type = "this file"; type = "this file";
} }
alert(_("pad.impexp.exportdisabled", {type:type})); alert(html10n.get("pad.impexp.exportdisabled", {type:type}));
return false; return false;
} }
@ -215,7 +216,10 @@ var padimpexp = (function()
var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path) var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path)
//i10l buttom import //i10l buttom import
$('#importsubmitinput').val(_("pad.impexp.importbutton")); $('#importsubmitinput').val(html10n.get("pad.impexp.importbutton"));
html10n.bind('localized', function() {
$('#importsubmitinput').val(html10n.get("pad.impexp.importbutton"));
})
// build the export links // build the export links
$("#exporthtmla").attr("href", pad_root_path + "/export/html"); $("#exporthtmla").attr("href", pad_root_path + "/export/html");