diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-04 16:21:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 08:43:01 +0200 |
commit | b1d40cff89f7cff565a98cdbcea9a624196a169a (patch) | |
tree | d24746c1cc69f50471a9eba0dfb1c1bae06a1870 /client/src/app/videos/+video-watch/comment/video-comments.component.ts | |
parent | 989e526abf0c0dd7958deb630df009608561bb67 (diff) | |
download | PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip |
Add i18n attributes
Diffstat (limited to 'client/src/app/videos/+video-watch/comment/video-comments.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comments.component.ts | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.ts b/client/src/app/videos/+video-watch/comment/video-comments.component.ts index 34f4a0701..8c6ddb89e 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.ts | |||
@@ -11,6 +11,7 @@ import { VideoSortField } from '../../../shared/video/sort-field.type' | |||
11 | import { VideoDetails } from '../../../shared/video/video-details.model' | 11 | import { VideoDetails } from '../../../shared/video/video-details.model' |
12 | import { VideoComment } from './video-comment.model' | 12 | import { VideoComment } from './video-comment.model' |
13 | import { VideoCommentService } from './video-comment.service' | 13 | import { VideoCommentService } from './video-comment.service' |
14 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
14 | 15 | ||
15 | @Component({ | 16 | @Component({ |
16 | selector: 'my-video-comments', | 17 | selector: 'my-video-comments', |
@@ -40,7 +41,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
40 | private notificationsService: NotificationsService, | 41 | private notificationsService: NotificationsService, |
41 | private confirmService: ConfirmService, | 42 | private confirmService: ConfirmService, |
42 | private videoCommentService: VideoCommentService, | 43 | private videoCommentService: VideoCommentService, |
43 | private activatedRoute: ActivatedRoute | 44 | private activatedRoute: ActivatedRoute, |
45 | private i18n: I18n | ||
44 | ) {} | 46 | ) {} |
45 | 47 | ||
46 | ngOnInit () { | 48 | ngOnInit () { |
@@ -77,7 +79,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
77 | if (highlightThread) this.highlightedThread = new VideoComment(res.comment) | 79 | if (highlightThread) this.highlightedThread = new VideoComment(res.comment) |
78 | }, | 80 | }, |
79 | 81 | ||
80 | err => this.notificationsService.error('Error', err.message) | 82 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
81 | ) | 83 | ) |
82 | } | 84 | } |
83 | 85 | ||
@@ -89,7 +91,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
89 | this.componentPagination.totalItems = res.totalComments | 91 | this.componentPagination.totalItems = res.totalComments |
90 | }, | 92 | }, |
91 | 93 | ||
92 | err => this.notificationsService.error('Error', err.message) | 94 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
93 | ) | 95 | ) |
94 | } | 96 | } |
95 | 97 | ||
@@ -111,9 +113,11 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
111 | 113 | ||
112 | async onWantedToDelete (commentToDelete: VideoComment) { | 114 | async onWantedToDelete (commentToDelete: VideoComment) { |
113 | let message = 'Do you really want to delete this comment?' | 115 | let message = 'Do you really want to delete this comment?' |
114 | if (commentToDelete.totalReplies !== 0) message += `${commentToDelete.totalReplies} would be deleted too.` | 116 | if (commentToDelete.totalReplies !== 0) { |
117 | message += this.i18n(' {{ totalReplies }} replies will be deleted too.', { totalReplies: commentToDelete.totalReplies }) | ||
118 | } | ||
115 | 119 | ||
116 | const res = await this.confirmService.confirm(message, 'Delete') | 120 | const res = await this.confirmService.confirm(message, this.i18n('Delete')) |
117 | if (res === false) return | 121 | if (res === false) return |
118 | 122 | ||
119 | this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) | 123 | this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) |
@@ -136,7 +140,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
136 | this.componentPagination.totalItems-- | 140 | this.componentPagination.totalItems-- |
137 | }, | 141 | }, |
138 | 142 | ||
139 | err => this.notificationsService.error('Error', err.message) | 143 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
140 | ) | 144 | ) |
141 | } | 145 | } |
142 | 146 | ||