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/app.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/app.component.ts')
-rw-r--r-- | client/src/app/app.component.ts | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index ee95d2cbb..ef0b1ae56 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -12,12 +12,11 @@ import { CustomModalComponent } from '@app/modal/custom-modal.component' | |||
12 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' | 12 | import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' |
13 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' | 13 | import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' |
14 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 14 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
15 | import { I18n } from '@ngx-translate/i18n-polyfill' | 15 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' |
16 | import { getShortLocale, is18nPath } from '@shared/core-utils/i18n' | 16 | import { getShortLocale, is18nPath } from '@shared/core-utils/i18n' |
17 | import { BroadcastMessageLevel, ServerConfig, UserRole } from '@shared/models' | 17 | import { BroadcastMessageLevel, ServerConfig, UserRole } from '@shared/models' |
18 | import { MenuService } from './core/menu/menu.service' | 18 | import { MenuService } from './core/menu/menu.service' |
19 | import { POP_STATE_MODAL_DISMISS } from './helpers' | 19 | import { POP_STATE_MODAL_DISMISS } from './helpers' |
20 | import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' | ||
21 | import { InstanceService } from './shared/shared-instance' | 20 | import { InstanceService } from './shared/shared-instance' |
22 | 21 | ||
23 | @Component({ | 22 | @Component({ |
@@ -40,7 +39,6 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
40 | constructor ( | 39 | constructor ( |
41 | @Inject(DOCUMENT) private document: Document, | 40 | @Inject(DOCUMENT) private document: Document, |
42 | @Inject(LOCALE_ID) private localeId: string, | 41 | @Inject(LOCALE_ID) private localeId: string, |
43 | private i18n: I18n, | ||
44 | private viewportScroller: ViewportScroller, | 42 | private viewportScroller: ViewportScroller, |
45 | private router: Router, | 43 | private router: Router, |
46 | private authService: AuthService, | 44 | private authService: AuthService, |
@@ -288,37 +286,37 @@ export class AppComponent implements OnInit, AfterViewInit { | |||
288 | new Hotkey(['/', 's'], (event: KeyboardEvent): boolean => { | 286 | new Hotkey(['/', 's'], (event: KeyboardEvent): boolean => { |
289 | document.getElementById('search-video').focus() | 287 | document.getElementById('search-video').focus() |
290 | return false | 288 | return false |
291 | }, undefined, this.i18n('Focus the search bar')), | 289 | }, undefined, $localize`Focus the search bar`), |
292 | 290 | ||
293 | new Hotkey('b', (event: KeyboardEvent): boolean => { | 291 | new Hotkey('b', (event: KeyboardEvent): boolean => { |
294 | this.menu.toggleMenu() | 292 | this.menu.toggleMenu() |
295 | return false | 293 | return false |
296 | }, undefined, this.i18n('Toggle the left menu')), | 294 | }, undefined, $localize`Toggle the left menu`), |
297 | 295 | ||
298 | new Hotkey('g o', (event: KeyboardEvent): boolean => { | 296 | new Hotkey('g o', (event: KeyboardEvent): boolean => { |
299 | this.router.navigate([ '/videos/overview' ]) | 297 | this.router.navigate([ '/videos/overview' ]) |
300 | return false | 298 | return false |
301 | }, undefined, this.i18n('Go to the discover videos page')), | 299 | }, undefined, $localize`Go to the discover videos page`), |
302 | 300 | ||
303 | new Hotkey('g t', (event: KeyboardEvent): boolean => { | 301 | new Hotkey('g t', (event: KeyboardEvent): boolean => { |
304 | this.router.navigate([ '/videos/trending' ]) | 302 | this.router.navigate([ '/videos/trending' ]) |
305 | return false | 303 | return false |
306 | }, undefined, this.i18n('Go to the trending videos page')), | 304 | }, undefined, $localize`Go to the trending videos page`), |
307 | 305 | ||
308 | new Hotkey('g r', (event: KeyboardEvent): boolean => { | 306 | new Hotkey('g r', (event: KeyboardEvent): boolean => { |
309 | this.router.navigate([ '/videos/recently-added' ]) | 307 | this.router.navigate([ '/videos/recently-added' ]) |
310 | return false | 308 | return false |
311 | }, undefined, this.i18n('Go to the recently added videos page')), | 309 | }, undefined, $localize`Go to the recently added videos page`), |
312 | 310 | ||
313 | new Hotkey('g l', (event: KeyboardEvent): boolean => { | 311 | new Hotkey('g l', (event: KeyboardEvent): boolean => { |
314 | this.router.navigate([ '/videos/local' ]) | 312 | this.router.navigate([ '/videos/local' ]) |
315 | return false | 313 | return false |
316 | }, undefined, this.i18n('Go to the local videos page')), | 314 | }, undefined, $localize`Go to the local videos page`), |
317 | 315 | ||
318 | new Hotkey('g u', (event: KeyboardEvent): boolean => { | 316 | new Hotkey('g u', (event: KeyboardEvent): boolean => { |
319 | this.router.navigate([ '/videos/upload' ]) | 317 | this.router.navigate([ '/videos/upload' ]) |
320 | return false | 318 | return false |
321 | }, undefined, this.i18n('Go to the videos upload page')) | 319 | }, undefined, $localize`Go to the videos upload page`) |
322 | ]) | 320 | ]) |
323 | } | 321 | } |
324 | } | 322 | } |