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/menu/menu.component.ts | |
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/menu/menu.component.ts')
-rw-r--r-- | client/src/app/menu/menu.component.ts | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/client/src/app/menu/menu.component.ts b/client/src/app/menu/menu.component.ts index 2c55b9a84..3d6cbda24 100644 --- a/client/src/app/menu/menu.component.ts +++ b/client/src/app/menu/menu.component.ts | |||
@@ -5,7 +5,6 @@ import { Component, OnInit, ViewChild } from '@angular/core' | |||
5 | import { AuthService, AuthStatus, AuthUser, RedirectService, ScreenService, ServerService, UserService } from '@app/core' | 5 | import { AuthService, AuthStatus, AuthUser, RedirectService, ScreenService, ServerService, UserService } from '@app/core' |
6 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' | 6 | import { LanguageChooserComponent } from '@app/menu/language-chooser.component' |
7 | import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' | 7 | import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component' |
8 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
9 | import { ServerConfig, UserRight, VideoConstant } from '@shared/models' | 8 | import { ServerConfig, UserRight, VideoConstant } from '@shared/models' |
10 | 9 | ||
11 | const logger = debug('peertube:menu:MenuComponent') | 10 | const logger = debug('peertube:menu:MenuComponent') |
@@ -44,9 +43,8 @@ export class MenuComponent implements OnInit { | |||
44 | private serverService: ServerService, | 43 | private serverService: ServerService, |
45 | private redirectService: RedirectService, | 44 | private redirectService: RedirectService, |
46 | private hotkeysService: HotkeysService, | 45 | private hotkeysService: HotkeysService, |
47 | private screenService: ScreenService, | 46 | private screenService: ScreenService |
48 | private i18n: I18n | 47 | ) { } |
49 | ) { } | ||
50 | 48 | ||
51 | get isInMobileView () { | 49 | get isInMobileView () { |
52 | return this.screenService.isInMobileView() | 50 | return this.screenService.isInMobileView() |
@@ -117,13 +115,13 @@ export class MenuComponent implements OnInit { | |||
117 | 115 | ||
118 | switch (this.user.nsfwPolicy) { | 116 | switch (this.user.nsfwPolicy) { |
119 | case 'do_not_list': | 117 | case 'do_not_list': |
120 | return this.i18n('hide') | 118 | return $localize`hide` |
121 | 119 | ||
122 | case 'blur': | 120 | case 'blur': |
123 | return this.i18n('blur') | 121 | return $localize`blur` |
124 | 122 | ||
125 | case 'display': | 123 | case 'display': |
126 | return this.i18n('display') | 124 | return $localize`display` |
127 | } | 125 | } |
128 | } | 126 | } |
129 | 127 | ||
@@ -189,7 +187,7 @@ export class MenuComponent implements OnInit { | |||
189 | } | 187 | } |
190 | 188 | ||
191 | langForLocale (localeId: string) { | 189 | langForLocale (localeId: string) { |
192 | if (localeId === '_unknown') return this.i18n('Unknown') | 190 | if (localeId === '_unknown') return $localize`Unknown` |
193 | 191 | ||
194 | return this.languages.find(lang => lang.id === localeId).label | 192 | return this.languages.find(lang => lang.id === localeId).label |
195 | } | 193 | } |
@@ -201,7 +199,7 @@ export class MenuComponent implements OnInit { | |||
201 | } | 199 | } |
202 | 200 | ||
203 | if (!this.user.videoLanguages) { | 201 | if (!this.user.videoLanguages) { |
204 | this.videoLanguages = [this.i18n('any language')] | 202 | this.videoLanguages = [$localize`any language`] |
205 | return | 203 | return |
206 | } | 204 | } |
207 | 205 | ||