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/+admin/follows/following-add/following-add.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/+admin/follows/following-add/following-add.component.ts')
-rw-r--r-- | client/src/app/+admin/follows/following-add/following-add.component.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/client/src/app/+admin/follows/following-add/following-add.component.ts b/client/src/app/+admin/follows/following-add/following-add.component.ts index c296c8852..f197c1fe9 100644 --- a/client/src/app/+admin/follows/following-add/following-add.component.ts +++ b/client/src/app/+admin/follows/following-add/following-add.component.ts | |||
@@ -4,6 +4,7 @@ import { NotificationsService } from 'angular2-notifications' | |||
4 | import { ConfirmService } from '../../../core' | 4 | import { ConfirmService } from '../../../core' |
5 | import { validateHost } from '../../../shared' | 5 | import { validateHost } from '../../../shared' |
6 | import { FollowService } from '../shared' | 6 | import { FollowService } from '../shared' |
7 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
7 | 8 | ||
8 | @Component({ | 9 | @Component({ |
9 | selector: 'my-following-add', | 10 | selector: 'my-following-add', |
@@ -19,7 +20,8 @@ export class FollowingAddComponent { | |||
19 | private router: Router, | 20 | private router: Router, |
20 | private notificationsService: NotificationsService, | 21 | private notificationsService: NotificationsService, |
21 | private confirmService: ConfirmService, | 22 | private confirmService: ConfirmService, |
22 | private followService: FollowService | 23 | private followService: FollowService, |
24 | private i18n: I18n | ||
23 | ) {} | 25 | ) {} |
24 | 26 | ||
25 | httpEnabled () { | 27 | httpEnabled () { |
@@ -34,7 +36,7 @@ export class FollowingAddComponent { | |||
34 | 36 | ||
35 | for (const host of hosts) { | 37 | for (const host of hosts) { |
36 | if (validateHost(host) === false) { | 38 | if (validateHost(host) === false) { |
37 | newHostsErrors.push(`${host} is not valid`) | 39 | newHostsErrors.push(this.i18n('{{ host }} is not valid', { host })) |
38 | } | 40 | } |
39 | } | 41 | } |
40 | 42 | ||
@@ -48,26 +50,26 @@ export class FollowingAddComponent { | |||
48 | 50 | ||
49 | const hosts = this.getNotEmptyHosts() | 51 | const hosts = this.getNotEmptyHosts() |
50 | if (hosts.length === 0) { | 52 | if (hosts.length === 0) { |
51 | this.error = 'You need to specify hosts to follow.' | 53 | this.error = this.i18n('You need to specify hosts to follow.') |
52 | } | 54 | } |
53 | 55 | ||
54 | if (!this.isHostsUnique(hosts)) { | 56 | if (!this.isHostsUnique(hosts)) { |
55 | this.error = 'Hosts need to be unique.' | 57 | this.error = this.i18n('Hosts need to be unique.') |
56 | return | 58 | return |
57 | } | 59 | } |
58 | 60 | ||
59 | const confirmMessage = 'If you confirm, you will send a follow request to:<br /> - ' + hosts.join('<br /> - ') | 61 | const confirmMessage = this.i18n('If you confirm, you will send a follow request to:<br /> - ') + hosts.join('<br /> - ') |
60 | const res = await this.confirmService.confirm(confirmMessage, 'Follow new server(s)') | 62 | const res = await this.confirmService.confirm(confirmMessage, this.i18n('Follow new server(s)')) |
61 | if (res === false) return | 63 | if (res === false) return |
62 | 64 | ||
63 | this.followService.follow(hosts).subscribe( | 65 | this.followService.follow(hosts).subscribe( |
64 | () => { | 66 | () => { |
65 | this.notificationsService.success('Success', 'Follow request(s) sent!') | 67 | this.notificationsService.success(this.i18n('Success'), this.i18n('Follow request(s) sent!')) |
66 | 68 | ||
67 | setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) | 69 | setTimeout(() => this.router.navigate([ '/admin/follows/following-list' ]), 500) |
68 | }, | 70 | }, |
69 | 71 | ||
70 | err => this.notificationsService.error('Error', err.message) | 72 | err => this.notificationsService.error(this.i18n('Error'), err.message) |
71 | ) | 73 | ) |
72 | } | 74 | } |
73 | 75 | ||
@@ -76,10 +78,8 @@ export class FollowingAddComponent { | |||
76 | } | 78 | } |
77 | 79 | ||
78 | private getNotEmptyHosts () { | 80 | private getNotEmptyHosts () { |
79 | const hosts = this.hostsString | 81 | return this.hostsString |
80 | .split('\n') | 82 | .split('\n') |
81 | .filter(host => host && host.length !== 0) // Eject empty hosts | 83 | .filter(host => host && host.length !== 0) // Eject empty hosts |
82 | |||
83 | return hosts | ||
84 | } | 84 | } |
85 | } | 85 | } |