diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-12 10:40:04 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-08-14 10:28:30 +0200 |
commit | 66357162f8e1227495f09bd4f68446aad7071c6d (patch) | |
tree | 7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/core/notification | |
parent | 8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff) | |
download | PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.gz PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.tar.zst PeerTube-66357162f8e1227495f09bd4f68446aad7071c6d.zip |
Migrate to $localize
* Remove i18n polyfill to translate things in components
* Reduce bundle sizes
* Improve runtime perf
* Reduce a lot the time to make a full client build
* Reduce client build complexity
* We don't need a service to translate things anymore (so we will be able to translate title pages etc)
Unfortunately we may loose some translations in the migration process.
I'll put a message on weblate to notify translators
Diffstat (limited to 'client/src/app/core/notification')
-rw-r--r-- | client/src/app/core/notification/notifier.service.ts | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/client/src/app/core/notification/notifier.service.ts b/client/src/app/core/notification/notifier.service.ts index 9833c65a0..f736672bb 100644 --- a/client/src/app/core/notification/notifier.service.ts +++ b/client/src/app/core/notification/notifier.service.ts | |||
@@ -1,30 +1,26 @@ | |||
1 | import { Injectable } from '@angular/core' | ||
2 | import { MessageService } from 'primeng/api' | 1 | import { MessageService } from 'primeng/api' |
3 | import { I18n } from '@ngx-translate/i18n-polyfill' | 2 | import { Injectable } from '@angular/core' |
4 | 3 | ||
5 | @Injectable() | 4 | @Injectable() |
6 | export class Notifier { | 5 | export class Notifier { |
7 | readonly TIMEOUT = 5000 | 6 | readonly TIMEOUT = 5000 |
8 | 7 | ||
9 | constructor ( | 8 | constructor (private messageService: MessageService) { } |
10 | private i18n: I18n, | ||
11 | private messageService: MessageService) { | ||
12 | } | ||
13 | 9 | ||
14 | info (text: string, title?: string, timeout?: number) { | 10 | info (text: string, title?: string, timeout?: number) { |
15 | if (!title) title = this.i18n('Info') | 11 | if (!title) title = $localize`Info` |
16 | 12 | ||
17 | return this.notify('info', text, title, timeout) | 13 | return this.notify('info', text, title, timeout) |
18 | } | 14 | } |
19 | 15 | ||
20 | error (text: string, title?: string, timeout?: number) { | 16 | error (text: string, title?: string, timeout?: number) { |
21 | if (!title) title = this.i18n('Error') | 17 | if (!title) title = $localize`Error` |
22 | 18 | ||
23 | return this.notify('error', text, title, timeout) | 19 | return this.notify('error', text, title, timeout) |
24 | } | 20 | } |
25 | 21 | ||
26 | success (text: string, title?: string, timeout?: number) { | 22 | success (text: string, title?: string, timeout?: number) { |
27 | if (!title) title = this.i18n('Success') | 23 | if (!title) title = $localize`Success` |
28 | 24 | ||
29 | return this.notify('success', text, title, timeout) | 25 | return this.notify('success', text, title, timeout) |
30 | } | 26 | } |