Commit 845f879b5044b3e5164ce8cd4f42f3e1926a6cd0
1 parent
d247ad88
Exists in
master
and in
28 other branches
Translate success message of post comment
Showing
4 changed files
with
16 additions
and
12 deletions
Show diff stats
src/app/article/comment/post-comment/post-comment.component.ts
@@ -29,7 +29,7 @@ export class PostCommentComponent { | @@ -29,7 +29,7 @@ export class PostCommentComponent { | ||
29 | this.commentService.createInArticle(this.article, this.comment).then((result: noosfero.RestResult<noosfero.Comment>) => { | 29 | this.commentService.createInArticle(this.article, this.comment).then((result: noosfero.RestResult<noosfero.Comment>) => { |
30 | this.$scope.$emit(PostCommentComponent.EVENT_COMMENT_RECEIVED, result.data); | 30 | this.$scope.$emit(PostCommentComponent.EVENT_COMMENT_RECEIVED, result.data); |
31 | this.comment.body = ""; | 31 | this.comment.body = ""; |
32 | - this.notificationService.success({ title: "Good job!", message: "Comment saved!" }); | 32 | + this.notificationService.success({ title: "comment.post.success.title", message: "comment.post.success.message" }); |
33 | }); | 33 | }); |
34 | } | 34 | } |
35 | } | 35 | } |
src/app/shared/services/notification.service.ts
@@ -20,13 +20,7 @@ export class NotificationService { | @@ -20,13 +20,7 @@ export class NotificationService { | ||
20 | title = NotificationService.DEFAULT_ERROR_TITLE, | 20 | title = NotificationService.DEFAULT_ERROR_TITLE, |
21 | showConfirmButton = true | 21 | showConfirmButton = true |
22 | } = {}) { | 22 | } = {}) { |
23 | - this.$log.debug("Notification error:", title, message, this.translatorService.currentLanguage()); | ||
24 | - this.SweetAlert.swal({ | ||
25 | - title: this.translatorService.translate(title), | ||
26 | - text: this.translatorService.translate(message), | ||
27 | - type: "error", | ||
28 | - showConfirmButton: showConfirmButton | ||
29 | - }); | 23 | + this.showMessage({ title: title, text: message, showConfirmButton: showConfirmButton, type: "error" }); |
30 | } | 24 | } |
31 | 25 | ||
32 | httpError(status: number, data: any): boolean { | 26 | httpError(status: number, data: any): boolean { |
@@ -39,11 +33,17 @@ export class NotificationService { | @@ -39,11 +33,17 @@ export class NotificationService { | ||
39 | message, | 33 | message, |
40 | timer = NotificationService.DEFAULT_SUCCESS_TIMER | 34 | timer = NotificationService.DEFAULT_SUCCESS_TIMER |
41 | }) { | 35 | }) { |
36 | + this.showMessage({ title: title, text: message, timer: timer }); | ||
37 | + } | ||
38 | + | ||
39 | + private showMessage({title, text, type = "success", timer = null, showConfirmButton = true}) { | ||
40 | + this.$log.debug("Notification message:", title, text, type, this.translatorService.currentLanguage()); | ||
42 | this.SweetAlert.swal({ | 41 | this.SweetAlert.swal({ |
43 | - title: title, | ||
44 | - text: message, | ||
45 | - type: "success", | ||
46 | - timer: timer | 42 | + title: this.translatorService.translate(title), |
43 | + text: this.translatorService.translate(text), | ||
44 | + type: type, | ||
45 | + timer: timer, | ||
46 | + showConfirmButton: showConfirmButton | ||
47 | }); | 47 | }); |
48 | } | 48 | } |
49 | 49 |
src/languages/en.json
@@ -33,5 +33,7 @@ | @@ -33,5 +33,7 @@ | ||
33 | "comment.post": "Post a comment", | 33 | "comment.post": "Post a comment", |
34 | "comment.post.placeholder": "Join the discussion...", | 34 | "comment.post.placeholder": "Join the discussion...", |
35 | "comment.pagination.more": "More", | 35 | "comment.pagination.more": "More", |
36 | + "comment.post.success.title": "Good job!", | ||
37 | + "comment.post.success.message": "Comment saved!", | ||
36 | "comment.reply": "reply" | 38 | "comment.reply": "reply" |
37 | } | 39 | } |
src/languages/pt.json
@@ -33,5 +33,7 @@ | @@ -33,5 +33,7 @@ | ||
33 | "comment.post": "Commentar", | 33 | "comment.post": "Commentar", |
34 | "comment.post.placeholder": "Participe da discussão...", | 34 | "comment.post.placeholder": "Participe da discussão...", |
35 | "comment.pagination.more": "Mais", | 35 | "comment.pagination.more": "Mais", |
36 | + "comment.post.success.title": "Bom trabalho!", | ||
37 | + "comment.post.success.message": "Comentário salvo com sucesso!", | ||
36 | "comment.reply": "responder" | 38 | "comment.reply": "responder" |
37 | } | 39 | } |