From ef47fc78eb92de8ebf64aaf0752bb6747847a028 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 2 Apr 2014 10:29:42 -0400 Subject: [PATCH] fixed up translation strings, closed #1278 --- public/language/en_GB/topic.json | 7 +++++++ public/src/forum/topic/postTools.js | 24 +++++++++++++----------- public/src/forum/topic/threadTools.js | 11 +++++++---- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/public/language/en_GB/topic.json b/public/language/en_GB/topic.json index d9ed9e0bd9..1a38c9f776 100644 --- a/public/language/en_GB/topic.json +++ b/public/language/en_GB/topic.json @@ -53,7 +53,14 @@ "thread_tools.move": "Move Topic", "thread_tools.fork": "Fork Topic", "thread_tools.delete": "Delete Topic", + "thread_tools.delete_confirm": "Are you sure you want to delete this thread?", "thread_tools.restore": "Restore Topic", + "thread_tools.restore_confirm": "Are you sure you want to restore this thread?", + + "post_delete_confirm": "Are you sure you want to delete this post?", + "post_restore_confirm": "Are you sure you want to restore this post?", + "post_delete_error": "Could not delete this post!", + "post_restore_error": "Could not restore this post!", "load_categories": "Loading Categories", "disabled_categories_note": "Disabled Categories are greyed out", diff --git a/public/src/forum/topic/postTools.js b/public/src/forum/topic/postTools.js index 58e6406d29..399095b9c0 100644 --- a/public/src/forum/topic/postTools.js +++ b/public/src/forum/topic/postTools.js @@ -143,17 +143,19 @@ define(['composer', 'share'], function(composer, share) { postEl = $(document.querySelector('#post-container li[data-pid="' + pid + '"]')), action = !postEl.hasClass('deleted') ? 'delete' : 'restore'; - bootbox.confirm('Are you sure you want to ' + action + ' this post?', function(confirm) { - if (confirm) { - socket.emit('posts.' + action, { - pid: pid, - tid: tid - }, function(err) { - if(err) { - return app.alertError('Can\'t ' + action + ' post!'); - } - }); - } + translator.translate('[[topic:post_' + action + '_confirm]]', function(msg) { + bootbox.confirm(msg, function(confirm) { + if (confirm) { + socket.emit('posts.' + action, { + pid: pid, + tid: tid + }, function(err) { + if(err) { + return translator.translate('[[topic:post_' + action + '_error]]', app.alertError); + } + }); + } + }); }); } diff --git a/public/src/forum/topic/threadTools.js b/public/src/forum/topic/threadTools.js index 46ca06e45d..0836b8d3b5 100644 --- a/public/src/forum/topic/threadTools.js +++ b/public/src/forum/topic/threadTools.js @@ -15,11 +15,14 @@ define(['forum/topic/fork', 'forum/topic/move'], function(fork, move) { $('.delete_thread').on('click', function(e) { var command = threadState.deleted !== '1' ? 'delete' : 'restore'; - bootbox.confirm('Are you sure you want to ' + command + ' this thread?', function(confirm) { - if (confirm) { - socket.emit('topics.' + command, tid); - } + translator.translate('[[topic:thread_tools.' + command + '_confirm]]', function(msg) { + bootbox.confirm(msg, function(confirm) { + if (confirm) { + socket.emit('topics.' + command, tid); + } + }); }); + return false; });