From: David ‘Bombe’ Roden Date: Thu, 1 Mar 2012 07:28:14 +0000 (+0100) Subject: Make “Comment” button translatable. X-Git-Tag: 0.8^2~20 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=a02811cd7b38393e0d59f8a90a8a617fd8ca160a;p=Sone.git Make “Comment” button translatable. --- diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index b8fb463..ac15636 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -413,6 +413,7 @@ WebInterface.DefaultText.Option.PostCutOffLength=Number of characters for the sn WebInterface.DefaultText.Option.PositiveTrust=The positive trust to assign WebInterface.DefaultText.Option.NegativeTrust=The negative trust to assign WebInterface.DefaultText.Option.TrustComment=The comment to set in the web of trust +WebInterface.Button.Comment=Comment WebInterface.Confirmation.DeletePostButton=Yes, delete! WebInterface.Confirmation.DeleteReplyButton=Yes, delete! WebInterface.SelectBox.Choose=Choose… diff --git a/src/main/resources/i18n/sone.fr.properties b/src/main/resources/i18n/sone.fr.properties index c4b468f..7572ec9 100644 --- a/src/main/resources/i18n/sone.fr.properties +++ b/src/main/resources/i18n/sone.fr.properties @@ -413,6 +413,7 @@ WebInterface.DefaultText.Option.PostCutOffLength=Number of characters for the sn WebInterface.DefaultText.Option.PositiveTrust=La note de confiance positive à assigner WebInterface.DefaultText.Option.NegativeTrust=Une note de confiance négative à assigner WebInterface.DefaultText.Option.TrustComment=Le commentaire à mettre dans le "Web of Trust" +WebInterface.Button.Comment=Commenter WebInterface.Confirmation.DeletePostButton=Oui, effacer! WebInterface.Confirmation.DeleteReplyButton=Oui, effacer! WebInterface.SelectBox.Choose=Choisir... diff --git a/src/main/resources/i18n/sone.ru.properties b/src/main/resources/i18n/sone.ru.properties index b525070..ad75d11 100644 --- a/src/main/resources/i18n/sone.ru.properties +++ b/src/main/resources/i18n/sone.ru.properties @@ -413,6 +413,7 @@ WebInterface.DefaultText.Option.PostCutOffLength=Количество симво WebInterface.DefaultText.Option.PositiveTrust=Положительное доверие для назначения WebInterface.DefaultText.Option.NegativeTrust=Отрицательное доверие для назначения WebInterface.DefaultText.Option.TrustComment=Комментарий для установки в web of trust +WebInterface.Button.Comment=Comment WebInterface.Confirmation.DeletePostButton=Да, удалить! WebInterface.Confirmation.DeleteReplyButton=Да, удалить! WebInterface.SelectBox.Choose=Выбрать… diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 6afb232..100e9db 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -67,30 +67,31 @@ function addCommentLink(postId, author, element, insertAfterThisElement) { if (($(element).find(".show-reply-form").length > 0) || (getPostElement(element).find(".create-reply").length == 0)) { return; } - commentElement = (function(postId, author) { + (function(postId, author, insertAfterThisElement) { separator = $(" · ").addClass("separator"); - var commentElement = $("
Comment
").addClass("show-reply-form").click(function() { - replyElement = $("#sone .post#post-" + postId + " .create-reply"); - replyElement.removeClass("hidden"); - replyElement.removeClass("light"); - (function(replyElement) { - replyElement.find("input.reply-input").blur(function() { - if ($(this).hasClass("default")) { - replyElement.addClass("light"); - } - }).focus(function() { - replyElement.removeClass("light"); - }); - })(replyElement); - textArea = replyElement.find("input.reply-input").focus().data("textarea"); - if (author != getCurrentSoneId()) { - textArea.val(textArea.val() + "@sone://" + author + " "); - } + getTranslation("WebInterface.Button.Comment", function(text) { + commentElement = $("
" + text + "
").addClass("show-reply-form").click(function() { + replyElement = $("#sone .post#post-" + postId + " .create-reply"); + replyElement.removeClass("hidden"); + replyElement.removeClass("light"); + (function(replyElement) { + replyElement.find("input.reply-input").blur(function() { + if ($(this).hasClass("default")) { + replyElement.addClass("light"); + } + }).focus(function() { + replyElement.removeClass("light"); + }); + })(replyElement); + textArea = replyElement.find("input.reply-input").focus().data("textarea"); + if (author != getCurrentSoneId()) { + textArea.val(textArea.val() + "@sone://" + author + " "); + } + }); + $(insertAfterThisElement).after(commentElement.clone(true)); + $(insertAfterThisElement).after(separator); }); - return commentElement; - })(postId, author); - $(insertAfterThisElement).after(commentElement.clone(true)); - $(insertAfterThisElement).after(separator); + })(postId, author, insertAfterThisElement); } var translations = {}; @@ -1923,8 +1924,10 @@ $(document).ready(function() { getTranslation("WebInterface.Confirmation.DeletePostButton", function(text) { getTranslation("WebInterface.Confirmation.DeleteReplyButton", function(text) { getTranslation("WebInterface.DefaultText.Reply", function(text) { - $("#sone .post").each(function() { - ajaxifyPost(this); + getTranslation("WebInterface.Button.Comment", function(text) { + $("#sone .post").each(function() { + ajaxifyPost(this); + }); }); }); });