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 | |
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')
5 files changed, 35 insertions, 26 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html index 54d7286db..eaf068cfa 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.html | |||
@@ -3,7 +3,7 @@ | |||
3 | <img [src]="user.accountAvatarUrl" alt="Avatar" /> | 3 | <img [src]="user.accountAvatarUrl" alt="Avatar" /> |
4 | 4 | ||
5 | <div class="form-group"> | 5 | <div class="form-group"> |
6 | <textarea placeholder="Add comment..." formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }" | 6 | <textarea i18n-placeholder placeholder="Add comment..." formControlName="text" [ngClass]="{ 'input-error': formErrors['text'] }" |
7 | (keyup.control.enter)="onValidKey()" (keyup.meta.enter)="onValidKey()" #textarea> | 7 | (keyup.control.enter)="onValidKey()" (keyup.meta.enter)="onValidKey()" #textarea> |
8 | 8 | ||
9 | </textarea> | 9 | </textarea> |
@@ -14,7 +14,7 @@ | |||
14 | </div> | 14 | </div> |
15 | 15 | ||
16 | <div class="submit-comment"> | 16 | <div class="submit-comment"> |
17 | <button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid }"> | 17 | <button *ngIf="isAddButtonDisplayed()" [ngClass]="{ disabled: !form.valid }" i18n> |
18 | Post comment | 18 | Post comment |
19 | </button> | 19 | </button> |
20 | </div> | 20 | </div> |
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index b1f446475..2ee5f5ef1 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -9,6 +9,7 @@ import { User } from '../../../shared/users' | |||
9 | import { Video } from '../../../shared/video/video.model' | 9 | import { Video } from '../../../shared/video/video.model' |
10 | import { VideoComment } from './video-comment.model' | 10 | import { VideoComment } from './video-comment.model' |
11 | import { VideoCommentService } from './video-comment.service' | 11 | import { VideoCommentService } from './video-comment.service' |
12 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
12 | 13 | ||
13 | @Component({ | 14 | @Component({ |
14 | selector: 'my-video-comment-add', | 15 | selector: 'my-video-comment-add', |
@@ -37,7 +38,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
37 | constructor ( | 38 | constructor ( |
38 | private formBuilder: FormBuilder, | 39 | private formBuilder: FormBuilder, |
39 | private notificationsService: NotificationsService, | 40 | private notificationsService: NotificationsService, |
40 | private videoCommentService: VideoCommentService | 41 | private videoCommentService: VideoCommentService, |
42 | private i18n: I18n | ||
41 | ) { | 43 | ) { |
42 | super() | 44 | super() |
43 | } | 45 | } |
@@ -92,7 +94,7 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
92 | this.form.reset() | 94 | this.form.reset() |
93 | }, | 95 | }, |
94 | 96 | ||
95 | err => this.notificationsService.error('Error', err.text) | 97 | err => this.notificationsService.error(this.i18n('Error'), err.text) |
96 | ) | 98 | ) |
97 | } | 99 | } |
98 | 100 | ||
diff --git a/client/src/app/videos/+video-watch/comment/video-comment.component.html b/client/src/app/videos/+video-watch/comment/video-comment.component.html index 06808ef80..60b803206 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comment.component.html | |||
@@ -2,7 +2,7 @@ | |||
2 | <img [src]="comment.accountAvatarUrl" alt="Avatar" /> | 2 | <img [src]="comment.accountAvatarUrl" alt="Avatar" /> |
3 | 3 | ||
4 | <div class="comment"> | 4 | <div class="comment"> |
5 | <div *ngIf="highlightedComment === true" class="highlighted-comment">Highlighted comment</div> | 5 | <div *ngIf="highlightedComment === true" class="highlighted-comment" i18n>Highlighted comment</div> |
6 | 6 | ||
7 | <div class="comment-account-date"> | 7 | <div class="comment-account-date"> |
8 | <a [href]="comment.account.url" target="_blank" rel="noopener noreferrer" class="comment-account">{{ comment.by }}</a> | 8 | <a [href]="comment.account.url" target="_blank" rel="noopener noreferrer" class="comment-account">{{ comment.by }}</a> |
@@ -11,8 +11,8 @@ | |||
11 | <div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div> | 11 | <div class="comment-html" [innerHTML]="sanitizedCommentHTML"></div> |
12 | 12 | ||
13 | <div class="comment-actions"> | 13 | <div class="comment-actions"> |
14 | <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply">Reply</div> | 14 | <div *ngIf="isUserLoggedIn()" (click)="onWantToReply()" class="comment-action-reply" i18n>Reply</div> |
15 | <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete">Delete</div> | 15 | <div *ngIf="isRemovableByUser()" (click)="onWantToDelete()" class="comment-action-delete" i18n>Delete</div> |
16 | </div> | 16 | </div> |
17 | 17 | ||
18 | <my-video-comment-add | 18 | <my-video-comment-add |
diff --git a/client/src/app/videos/+video-watch/comment/video-comments.component.html b/client/src/app/videos/+video-watch/comment/video-comments.component.html index 114a56dc7..ac7c03648 100644 --- a/client/src/app/videos/+video-watch/comment/video-comments.component.html +++ b/client/src/app/videos/+video-watch/comment/video-comments.component.html | |||
@@ -3,7 +3,10 @@ | |||
3 | <div class="title-page title-page-single"> | 3 | <div class="title-page title-page-single"> |
4 | Comments | 4 | Comments |
5 | </div> | 5 | </div> |
6 | <my-help *ngIf="video.commentsEnabled === true" helpType="custom" customHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.displayName}}@{{video.account.host}}</strong> and find back the video. Direct commenting capabilities are being worked on in <a href='https://github.com/Chocobozzz/PeerTube/issues/224'>#224</a>."></my-help> | 6 | <my-help |
7 | *ngIf="video.commentsEnabled === true" helpType="custom" i18n-customHtml | ||
8 | customHtml="You can either comment on the page of your instance where this video is federated with your PeerTube account, or via any ActivityPub-capable fediverse instance. For instance with Mastodon or Pleroma you can type in the search box <strong>@{{video.account.displayName}}@{{video.account.host}}</strong> and find back the video. Direct commenting capabilities are being worked on in <a href='https://github.com/Chocobozzz/PeerTube/issues/224'>#224</a>." | ||
9 | ></my-help> | ||
7 | </div> | 10 | </div> |
8 | 11 | ||
9 | <ng-template [ngIf]="video.commentsEnabled === true"> | 12 | <ng-template [ngIf]="video.commentsEnabled === true"> |
@@ -14,7 +17,7 @@ | |||
14 | (commentCreated)="onCommentThreadCreated($event)" | 17 | (commentCreated)="onCommentThreadCreated($event)" |
15 | ></my-video-comment-add> | 18 | ></my-video-comment-add> |
16 | 19 | ||
17 | <div *ngIf="componentPagination.totalItems === 0 && comments.length === 0">No comments.</div> | 20 | <div *ngIf="componentPagination.totalItems === 0 && comments.length === 0" i18n>No comments.</div> |
18 | 21 | ||
19 | <div | 22 | <div |
20 | class="comment-threads" | 23 | class="comment-threads" |
@@ -24,15 +27,15 @@ | |||
24 | > | 27 | > |
25 | <div *ngIf="highlightedThread" id="highlighted-comment"> | 28 | <div *ngIf="highlightedThread" id="highlighted-comment"> |
26 | <my-video-comment | 29 | <my-video-comment |
27 | [comment]="highlightedThread" | 30 | [comment]="highlightedThread" |
28 | [video]="video" | 31 | [video]="video" |
29 | [inReplyToCommentId]="inReplyToCommentId" | 32 | [inReplyToCommentId]="inReplyToCommentId" |
30 | [commentTree]="threadComments[highlightedThread.id]" | 33 | [commentTree]="threadComments[highlightedThread.id]" |
31 | [highlightedComment]="true" | 34 | [highlightedComment]="true" |
32 | (wantedToReply)="onWantedToReply($event)" | 35 | (wantedToReply)="onWantedToReply($event)" |
33 | (wantedToDelete)="onWantedToDelete($event)" | 36 | (wantedToDelete)="onWantedToDelete($event)" |
34 | (threadCreated)="onThreadCreated($event)" | 37 | (threadCreated)="onThreadCreated($event)" |
35 | (resetReply)="onResetReply()" | 38 | (resetReply)="onResetReply()" |
36 | ></my-video-comment> | 39 | ></my-video-comment> |
37 | </div> | 40 | </div> |
38 | 41 | ||
@@ -50,7 +53,7 @@ | |||
50 | ></my-video-comment> | 53 | ></my-video-comment> |
51 | 54 | ||
52 | <div *ngIf="comment.totalReplies !== 0 && !threadComments[comment.id]" (click)="viewReplies(comment.id)" class="view-replies"> | 55 | <div *ngIf="comment.totalReplies !== 0 && !threadComments[comment.id]" (click)="viewReplies(comment.id)" class="view-replies"> |
53 | View all {{ comment.totalReplies }} replies | 56 | <ng-container i18n>View all {{ comment.totalReplies }} replies</ng-container> |
54 | 57 | ||
55 | <span *ngIf="!threadLoading[comment.id]" class="glyphicon glyphicon-menu-down"></span> | 58 | <span *ngIf="!threadLoading[comment.id]" class="glyphicon glyphicon-menu-down"></span> |
56 | <my-loader class="comment-thread-loading" [loading]="threadLoading[comment.id]"></my-loader> | 59 | <my-loader class="comment-thread-loading" [loading]="threadLoading[comment.id]"></my-loader> |
@@ -59,7 +62,7 @@ | |||
59 | </div> | 62 | </div> |
60 | </ng-template> | 63 | </ng-template> |
61 | 64 | ||
62 | <div *ngIf="video.commentsEnabled === false"> | 65 | <div *ngIf="video.commentsEnabled === false" i18n> |
63 | Comments are disabled. | 66 | Comments are disabled. |
64 | </div> | 67 | </div> |
65 | </div> | 68 | </div> |
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 | ||