From 81ba8116220809a35f1aeb14f1e0bf1d34478afe Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 5 Aug 2018 16:29:49 +0200 Subject: [PATCH] Added comments component translation. --- assets/js/components/comments/actions.js | 2 +- assets/js/components/comments/editor.js | 6 +++--- assets/js/components/comments/form.js | 8 ++++---- assets/js/components/comments/ui.js | 8 ++++---- assets/js/langs/en.inc.js | 21 +++++++++++++++++++++ 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/assets/js/components/comments/actions.js b/assets/js/components/comments/actions.js index a7b3aa3c..041dce76 100644 --- a/assets/js/components/comments/actions.js +++ b/assets/js/components/comments/actions.js @@ -25,7 +25,7 @@ ComunicWeb.components.comments.actions = { //Check for errors if(result.error){ - ComunicWeb.common.notificationSystem.showNotification("Couldn't get informations about a comment !", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("comments_actions_err_get_info_single"), "danger"); return; } diff --git a/assets/js/components/comments/editor.js b/assets/js/components/comments/editor.js index 915c6bbe..42eb2f9f 100644 --- a/assets/js/components/comments/editor.js +++ b/assets/js/components/comments/editor.js @@ -26,7 +26,7 @@ ComunicWeb.components.comments.editor = { //Check for error if(result.error){ - ComunicWeb.common.notificationSystem.showNotification("An error occured while trying to update comment content !", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("comments_editor_err_update"), "danger"); return; } @@ -39,8 +39,8 @@ ComunicWeb.components.comments.editor = { //Prompt the user to enter the new content of the comment ComunicWeb.common.messages.inputString( - "Edit comment content", - "Please specify the new content of the comment: ", + lang("comments_editor_title"), + lang("comments_editor_notice"), infos.content, inputCallback ); diff --git a/assets/js/components/comments/form.js b/assets/js/components/comments/form.js index 8b4a0993..bcef0f5f 100644 --- a/assets/js/components/comments/form.js +++ b/assets/js/components/comments/form.js @@ -46,7 +46,7 @@ ComunicWeb.components.comments.form = { type: "input", elemType: "text", class: "form-control", - placeholder: "New comment...", + placeholder: lang("comments_form_input_placeholder"), name: "content" }); newCommentText.maxLength = 255; @@ -106,7 +106,7 @@ ComunicWeb.components.comments.form = { appendTo: buttonsGroup, type: "button", class: "btn btn-default btn-flat", - innerHTML: "Send" + innerHTML: lang("comments_form_send") }); //Catch form when submitted @@ -117,7 +117,7 @@ ComunicWeb.components.comments.form = { //Check the comment if(!hasImage && newCommentText.value < 5){ - ComunicWeb.common.notificationSystem.showNotification("Please type a valid comment! (at least 5 characters)", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("comments_form_err_invalid_comment"), "danger"); return false; } @@ -140,7 +140,7 @@ ComunicWeb.components.comments.form = { //Check for errors if(result.error){ - ComunicWeb.common.notificationSystem.showNotification("Couldn't create comment! (check its content)", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("comments_form_err_create_comment"), "danger"); return; } diff --git a/assets/js/components/comments/ui.js b/assets/js/components/comments/ui.js index 769bd0e5..831d269e 100644 --- a/assets/js/components/comments/ui.js +++ b/assets/js/components/comments/ui.js @@ -23,7 +23,7 @@ ComunicWeb.components.comments.ui = { //Check for errors if(result.error){ - ComunicWeb.common.notificationSystem.showNotification("Couldn't informations about some users to display their comments !", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("comments_ui_err_get_users_info"), "danger"); return; } @@ -75,7 +75,7 @@ ComunicWeb.components.comments.ui = { //Check for errors if(result.error){ - ComunicWeb.common.notificationSystem.showNotification("Couldn't get informations about a user!", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("comments_ui_err_get_user_info"), "danger"); return; } @@ -191,7 +191,7 @@ ComunicWeb.components.comments.ui = { //Make delete button lives deleteCommentLink.onclick = function(){ - ComunicWeb.common.messages.confirm("Are you sure do you want to delete this comment ? This operation is unrecoverable!", function(response){ + ComunicWeb.common.messages.confirm(lang("comments_ui_confirm_delete"), function(response){ //Check if user cancelled the operation if(!response) @@ -207,7 +207,7 @@ ComunicWeb.components.comments.ui = { //Check for errors if(response.error){ - ComunicWeb.common.notificationSystem.showNotification("Could not delete comment!", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("comments_ui_err_delete_comment"), "danger"); return; } diff --git a/assets/js/langs/en.inc.js b/assets/js/langs/en.inc.js index 1702fbe0..d524d6ee 100644 --- a/assets/js/langs/en.inc.js +++ b/assets/js/langs/en.inc.js @@ -111,6 +111,27 @@ ComunicWeb.common.langs.en = { notifications_dropdown_no_notif_notice: "You do not have any notification yet.", + //Comments - Actions + comments_actions_err_get_info_single: "Couldn't get informations about a comment !", + + //Comments - Editor + comments_editor_err_update: "An error occured while trying to update comment content !", + comments_editor_title: "Edit comment content", + comments_editor_notice: "Please specify the new content of the comment: ", + + //Comments - UI + comments_ui_err_get_users_info: "Couldn't information about some users to display their comments !", + comments_ui_err_get_user_info: "Couldn't get information about a user!", + comments_ui_confirm_delete: "Are you sure do you want to delete this comment ? This operation is unrecoverable!", + comments_ui_err_delete_comment: "Could not delete comment!", + + //Comments - Form + comments_form_input_placeholder: "New comment...", + comments_form_send: "Send", + comments_form_err_invalid_comment: "Please type a valid comment! (at least 5 characters)", + comments_form_err_create_comment: "Couldn't create comment! (check its content)", + + /** * Pages */