From 845f879b5044b3e5164ce8cd4f42f3e1926a6cd0 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 7 Apr 2016 17:20:38 -0300 Subject: [PATCH] Translate success message of post comment --- src/app/article/comment/post-comment/post-comment.component.ts | 2 +- src/app/shared/services/notification.service.ts | 22 +++++++++++----------- src/languages/en.json | 2 ++ src/languages/pt.json | 2 ++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/app/article/comment/post-comment/post-comment.component.ts b/src/app/article/comment/post-comment/post-comment.component.ts index 3a3b2b0..64a70ef 100644 --- a/src/app/article/comment/post-comment/post-comment.component.ts +++ b/src/app/article/comment/post-comment/post-comment.component.ts @@ -29,7 +29,7 @@ export class PostCommentComponent { this.commentService.createInArticle(this.article, this.comment).then((result: noosfero.RestResult) => { this.$scope.$emit(PostCommentComponent.EVENT_COMMENT_RECEIVED, result.data); this.comment.body = ""; - this.notificationService.success({ title: "Good job!", message: "Comment saved!" }); + this.notificationService.success({ title: "comment.post.success.title", message: "comment.post.success.message" }); }); } } diff --git a/src/app/shared/services/notification.service.ts b/src/app/shared/services/notification.service.ts index 1b5f866..3ac8839 100644 --- a/src/app/shared/services/notification.service.ts +++ b/src/app/shared/services/notification.service.ts @@ -20,13 +20,7 @@ export class NotificationService { title = NotificationService.DEFAULT_ERROR_TITLE, showConfirmButton = true } = {}) { - this.$log.debug("Notification error:", title, message, this.translatorService.currentLanguage()); - this.SweetAlert.swal({ - title: this.translatorService.translate(title), - text: this.translatorService.translate(message), - type: "error", - showConfirmButton: showConfirmButton - }); + this.showMessage({ title: title, text: message, showConfirmButton: showConfirmButton, type: "error" }); } httpError(status: number, data: any): boolean { @@ -39,11 +33,17 @@ export class NotificationService { message, timer = NotificationService.DEFAULT_SUCCESS_TIMER }) { + this.showMessage({ title: title, text: message, timer: timer }); + } + + private showMessage({title, text, type = "success", timer = null, showConfirmButton = true}) { + this.$log.debug("Notification message:", title, text, type, this.translatorService.currentLanguage()); this.SweetAlert.swal({ - title: title, - text: message, - type: "success", - timer: timer + title: this.translatorService.translate(title), + text: this.translatorService.translate(text), + type: type, + timer: timer, + showConfirmButton: showConfirmButton }); } diff --git a/src/languages/en.json b/src/languages/en.json index 966eec5..8a350b4 100644 --- a/src/languages/en.json +++ b/src/languages/en.json @@ -33,5 +33,7 @@ "comment.post": "Post a comment", "comment.post.placeholder": "Join the discussion...", "comment.pagination.more": "More", + "comment.post.success.title": "Good job!", + "comment.post.success.message": "Comment saved!", "comment.reply": "reply" } diff --git a/src/languages/pt.json b/src/languages/pt.json index dbedfd5..1b685a0 100644 --- a/src/languages/pt.json +++ b/src/languages/pt.json @@ -33,5 +33,7 @@ "comment.post": "Commentar", "comment.post.placeholder": "Participe da discussão...", "comment.pagination.more": "Mais", + "comment.post.success.title": "Bom trabalho!", + "comment.post.success.message": "Comentário salvo com sucesso!", "comment.reply": "responder" } -- libgit2 0.21.2