diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-06 14:32:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-29 09:49:06 +0200 |
commit | 866c5f667da9fc09f3b093ff0a6f89d4af0ce5af (patch) | |
tree | 7a42f7974cec400f9cf09e86de00e69e36b2136d /client/src/app/+admin/follows | |
parent | 40346ead2b0b7afa475aef057d3673b6c7574b7a (diff) | |
download | PeerTube-866c5f667da9fc09f3b093ff0a6f89d4af0ce5af.tar.gz PeerTube-866c5f667da9fc09f3b093ff0a6f89d4af0ce5af.tar.zst PeerTube-866c5f667da9fc09f3b093ff0a6f89d4af0ce5af.zip |
Simplify ICU in components
Diffstat (limited to 'client/src/app/+admin/follows')
3 files changed, 27 insertions, 27 deletions
diff --git a/client/src/app/+admin/follows/followers-list/followers-list.component.ts b/client/src/app/+admin/follows/followers-list/followers-list.component.ts index cebb2e1a2..618892242 100644 --- a/client/src/app/+admin/follows/followers-list/followers-list.component.ts +++ b/client/src/app/+admin/follows/followers-list/followers-list.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { Component, OnInit } from '@angular/core' | 2 | import { Component, OnInit } from '@angular/core' |
3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' | 3 | import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core' |
4 | import { prepareIcu } from '@app/helpers' | 4 | import { formatICU } from '@app/helpers' |
5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' | 5 | import { AdvancedInputFilter } from '@app/shared/shared-forms' |
6 | import { InstanceFollowService } from '@app/shared/shared-instance' | 6 | import { InstanceFollowService } from '@app/shared/shared-instance' |
7 | import { DropdownAction } from '@app/shared/shared-main' | 7 | import { DropdownAction } from '@app/shared/shared-main' |
@@ -63,9 +63,9 @@ export class FollowersListComponent extends RestTable <ActorFollow> implements O | |||
63 | .subscribe({ | 63 | .subscribe({ |
64 | next: () => { | 64 | next: () => { |
65 | // eslint-disable-next-line max-len | 65 | // eslint-disable-next-line max-len |
66 | const message = prepareIcu($localize`Accepted {count, plural, =1 {{followerName} follow request} other {{count} follow requests}}`)( | 66 | const message = formatICU( |
67 | { count: follows.length, followerName: this.buildFollowerName(follows[0]) }, | 67 | $localize`Accepted {count, plural, =1 {{followerName} follow request} other {{count} follow requests}}`, |
68 | $localize`Follow requests accepted` | 68 | { count: follows.length, followerName: this.buildFollowerName(follows[0]) } |
69 | ) | 69 | ) |
70 | this.notifier.success(message) | 70 | this.notifier.success(message) |
71 | 71 | ||
@@ -78,9 +78,9 @@ export class FollowersListComponent extends RestTable <ActorFollow> implements O | |||
78 | 78 | ||
79 | async rejectFollower (follows: ActorFollow[]) { | 79 | async rejectFollower (follows: ActorFollow[]) { |
80 | // eslint-disable-next-line max-len | 80 | // eslint-disable-next-line max-len |
81 | const message = prepareIcu($localize`Do you really want to reject {count, plural, =1 {{followerName} follow request?} other {{count} follow requests?}}`)( | 81 | const message = formatICU( |
82 | { count: follows.length, followerName: this.buildFollowerName(follows[0]) }, | 82 | $localize`Do you really want to reject {count, plural, =1 {{followerName} follow request?} other {{count} follow requests?}}`, |
83 | $localize`Do you really want to reject these follow requests?` | 83 | { count: follows.length, followerName: this.buildFollowerName(follows[0]) } |
84 | ) | 84 | ) |
85 | 85 | ||
86 | const res = await this.confirmService.confirm(message, $localize`Reject`) | 86 | const res = await this.confirmService.confirm(message, $localize`Reject`) |
@@ -90,9 +90,9 @@ export class FollowersListComponent extends RestTable <ActorFollow> implements O | |||
90 | .subscribe({ | 90 | .subscribe({ |
91 | next: () => { | 91 | next: () => { |
92 | // eslint-disable-next-line max-len | 92 | // eslint-disable-next-line max-len |
93 | const message = prepareIcu($localize`Rejected {count, plural, =1 {{followerName} follow request} other {{count} follow requests}}`)( | 93 | const message = formatICU( |
94 | { count: follows.length, followerName: this.buildFollowerName(follows[0]) }, | 94 | $localize`Rejected {count, plural, =1 {{followerName} follow request} other {{count} follow requests}}`, |
95 | $localize`Follow requests rejected` | 95 | { count: follows.length, followerName: this.buildFollowerName(follows[0]) } |
96 | ) | 96 | ) |
97 | this.notifier.success(message) | 97 | this.notifier.success(message) |
98 | 98 | ||
@@ -110,9 +110,9 @@ export class FollowersListComponent extends RestTable <ActorFollow> implements O | |||
110 | message += '<br /><br />' | 110 | message += '<br /><br />' |
111 | 111 | ||
112 | // eslint-disable-next-line max-len | 112 | // eslint-disable-next-line max-len |
113 | message += prepareIcu($localize`Do you really want to delete {count, plural, =1 {{followerName} follow request?} other {{count} follow requests?}}`)( | 113 | message += formatICU( |
114 | icuParams, | 114 | $localize`Do you really want to delete {count, plural, =1 {{followerName} follow request?} other {{count} follow requests?}}`, |
115 | $localize`Do you really want to delete these follow requests?` | 115 | icuParams |
116 | ) | 116 | ) |
117 | 117 | ||
118 | const res = await this.confirmService.confirm(message, $localize`Delete`) | 118 | const res = await this.confirmService.confirm(message, $localize`Delete`) |
@@ -122,9 +122,9 @@ export class FollowersListComponent extends RestTable <ActorFollow> implements O | |||
122 | .subscribe({ | 122 | .subscribe({ |
123 | next: () => { | 123 | next: () => { |
124 | // eslint-disable-next-line max-len | 124 | // eslint-disable-next-line max-len |
125 | const message = prepareIcu($localize`Removed {count, plural, =1 {{followerName} follow request} other {{count} follow requests}}`)( | 125 | const message = formatICU( |
126 | icuParams, | 126 | $localize`Removed {count, plural, =1 {{followerName} follow request} other {{count} follow requests}}`, |
127 | $localize`Follow requests removed` | 127 | icuParams |
128 | ) | 128 | ) |
129 | 129 | ||
130 | this.notifier.success(message) | 130 | this.notifier.success(message) |
diff --git a/client/src/app/+admin/follows/following-list/follow-modal.component.ts b/client/src/app/+admin/follows/following-list/follow-modal.component.ts index 8f74e82a6..54b3cebc5 100644 --- a/client/src/app/+admin/follows/following-list/follow-modal.component.ts +++ b/client/src/app/+admin/follows/following-list/follow-modal.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' | 1 | import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { Notifier } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { prepareIcu } from '@app/helpers' | 3 | import { formatICU } from '@app/helpers' |
4 | import { splitAndGetNotEmpty, UNIQUE_HOSTS_OR_HANDLE_VALIDATOR } from '@app/shared/form-validators/host-validators' | 4 | import { splitAndGetNotEmpty, UNIQUE_HOSTS_OR_HANDLE_VALIDATOR } from '@app/shared/form-validators/host-validators' |
5 | import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' | 5 | import { FormReactive, FormReactiveService } from '@app/shared/shared-forms' |
6 | import { InstanceFollowService } from '@app/shared/shared-instance' | 6 | import { InstanceFollowService } from '@app/shared/shared-instance' |
@@ -62,9 +62,9 @@ export class FollowModalComponent extends FormReactive implements OnInit { | |||
62 | .subscribe({ | 62 | .subscribe({ |
63 | next: () => { | 63 | next: () => { |
64 | this.notifier.success( | 64 | this.notifier.success( |
65 | prepareIcu($localize`{count, plural, =1 {Follow request sent!} other {Follow requests sent!}}`)( | 65 | formatICU( |
66 | { count: hostsOrHandles.length }, | 66 | $localize`{count, plural, =1 {Follow request sent!} other {Follow requests sent!}}`, |
67 | $localize`Follow request(s) sent!` | 67 | { count: hostsOrHandles.length } |
68 | ) | 68 | ) |
69 | ) | 69 | ) |
70 | 70 | ||
diff --git a/client/src/app/+admin/follows/following-list/following-list.component.ts b/client/src/app/+admin/follows/following-list/following-list.component.ts index 71f2fbe66..6c8723c16 100644 --- a/client/src/app/+admin/follows/following-list/following-list.component.ts +++ b/client/src/app/+admin/follows/following-list/following-list.component.ts | |||
@@ -6,7 +6,7 @@ import { InstanceFollowService } from '@app/shared/shared-instance' | |||
6 | import { ActorFollow } from '@shared/models' | 6 | import { ActorFollow } from '@shared/models' |
7 | import { FollowModalComponent } from './follow-modal.component' | 7 | import { FollowModalComponent } from './follow-modal.component' |
8 | import { DropdownAction } from '@app/shared/shared-main' | 8 | import { DropdownAction } from '@app/shared/shared-main' |
9 | import { prepareIcu } from '@app/helpers' | 9 | import { formatICU } from '@app/helpers' |
10 | 10 | ||
11 | @Component({ | 11 | @Component({ |
12 | templateUrl: './following-list.component.html', | 12 | templateUrl: './following-list.component.html', |
@@ -64,9 +64,9 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O | |||
64 | async removeFollowing (follows: ActorFollow[]) { | 64 | async removeFollowing (follows: ActorFollow[]) { |
65 | const icuParams = { count: follows.length, entryName: this.buildFollowingName(follows[0]) } | 65 | const icuParams = { count: follows.length, entryName: this.buildFollowingName(follows[0]) } |
66 | 66 | ||
67 | const message = prepareIcu($localize`Do you really want to unfollow {count, plural, =1 {{entryName}?} other {{count} entries?}}`)( | 67 | const message = formatICU( |
68 | icuParams, | 68 | $localize`Do you really want to unfollow {count, plural, =1 {{entryName}?} other {{count} entries?}}`, |
69 | $localize`Do you really want to unfollow these entries?` | 69 | icuParams |
70 | ) | 70 | ) |
71 | 71 | ||
72 | const res = await this.confirmService.confirm(message, $localize`Unfollow`) | 72 | const res = await this.confirmService.confirm(message, $localize`Unfollow`) |
@@ -76,9 +76,9 @@ export class FollowingListComponent extends RestTable <ActorFollow> implements O | |||
76 | .subscribe({ | 76 | .subscribe({ |
77 | next: () => { | 77 | next: () => { |
78 | // eslint-disable-next-line max-len | 78 | // eslint-disable-next-line max-len |
79 | const message = prepareIcu($localize`You are not following {count, plural, =1 {{entryName} anymore.} other {these {count} entries anymore.}}`)( | 79 | const message = formatICU( |
80 | icuParams, | 80 | $localize`You are not following {count, plural, =1 {{entryName} anymore.} other {these {count} entries anymore.}}`, |
81 | $localize`You are not following them anymore.` | 81 | icuParams |
82 | ) | 82 | ) |
83 | 83 | ||
84 | this.notifier.success(message) | 84 | this.notifier.success(message) |