From 02744d5c72ecd7339d640e422f70c8eb4124d81e Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sun, 5 Aug 2018 16:13:48 +0200 Subject: [PATCH] Translated post UI. --- assets/js/components/posts/ui.js | 18 +++++++++--------- assets/js/langs/en.inc.js | 11 +++++++++++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/assets/js/components/posts/ui.js b/assets/js/components/posts/ui.js index 12115a6a..fa253fae 100644 --- a/assets/js/components/posts/ui.js +++ b/assets/js/components/posts/ui.js @@ -112,7 +112,7 @@ ComunicWeb.components.posts.ui = { getMultipleUsersInfos(usersToFetch, function(result){ if(result.error) { ComunicWeb.debug.logMessage("Could not get some users info!"); - userName.innerHTML = "Error"; + userName.innerHTML = lang("posts_ui_error"); return; } @@ -259,7 +259,7 @@ ComunicWeb.components.posts.ui = { //Check for errors if(response.error){ - ComunicWeb.common.notificationSystem.showNotification("Couldn't change post visibility level !", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("posts_ui_err_update_visibility"), "danger"); return; } @@ -326,7 +326,7 @@ ComunicWeb.components.posts.ui = { deleteButtonLink.onclick = function(){ //Create a confirmation dialog - ComunicWeb.common.messages.confirm("Are you sure do you want to delete this post? The operation can not be reverted !", function(accept){ + ComunicWeb.common.messages.confirm(lang("posts_ui_confirm_delete"), function(accept){ //Check if the user cancelled the operation if(!accept) @@ -341,7 +341,7 @@ ComunicWeb.components.posts.ui = { if(response.error){ //Display an error - ComunicWeb.common.notificationSystem.showNotification("An error occured while trying to delete post !", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("posts_ui_err_delete_post"), "danger"); //Make the post visible postRoot.style.visibility = "visible"; @@ -700,20 +700,20 @@ ComunicWeb.components.posts.ui = { appendTo: surveyResponse, class: "survey-given-response", type: "p", - innerHTML: "Your response: " + info.data_survey.choices[info.data_survey.user_choice].name + " " + innerHTML: lang("posts_ui_survey_your_response", [info.data_survey.choices[info.data_survey.user_choice].name]) }); //Offer the user to cancel his choice var cancelReponseLink = createElem2({ appendTo: choosedResponseElem, type: "a", - innerHTML: "Cancel" + innerHTML: lang("posts_ui_cance_response_survey") }); //Make cancel button lives cancelReponseLink.onclick = function(){ - ComunicWeb.common.messages.confirm("Do you really want to cancel your response to the survey ?", function(confirm){ + ComunicWeb.common.messages.confirm(lang("posts_ui_confirm_cancel_survey_response"), function(confirm){ //Check if the user cancelled if(!confirm) @@ -724,7 +724,7 @@ ComunicWeb.components.posts.ui = { //Check for errors if(response.error){ - ComunicWeb.common.notificationSystem.showNotification("Could not cancel response to survey !", "danger"); + ComunicWeb.common.notificationSystem.showNotification(lang("posts_ui_err_cancel_response_survey"), "danger"); return; } @@ -778,7 +778,7 @@ ComunicWeb.components.posts.ui = { appendTo: chooseButtonSpan, type: "button", class: "btn btn-default", - innerHTML: "Send" + innerHTML: lang("posts_ui_send_survey_response") }); //Make confirm button lives diff --git a/assets/js/langs/en.inc.js b/assets/js/langs/en.inc.js index ab6e7d53..1702fbe0 100644 --- a/assets/js/langs/en.inc.js +++ b/assets/js/langs/en.inc.js @@ -35,6 +35,17 @@ ComunicWeb.common.langs.en = { menu_bar_action_settings: "Settings", _menu_bar_action_logout: "Logout", + //Posts - UI + posts_ui_error: "Error", + posts_ui_err_update_visibility: "Couldn't change post visibility level !", + posts_ui_confirm_delete: "Are you sure do you want to delete this post? The operation can not be reverted !", + posts_ui_err_delete_post: "An error occured while trying to delete post !", + posts_ui_survey_your_response: "Your response: %p ", + posts_ui_confirm_cancel_survey_response: "Do you really want to cancel your response to the survey ?", + posts_ui_err_cancel_response_survey: "Could not cancel response to survey !", + posts_ui_send_survey_response: "Send", + posts_ui_cance_response_survey: "Cancel", + //Posts form _post_type_text: "Text", _post_type_youtube: "Youtube",