aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+signup
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-12 10:40:04 +0200
committerChocobozzz <me@florianbigard.com>2020-08-14 10:28:30 +0200
commit66357162f8e1227495f09bd4f68446aad7071c6d (patch)
tree7d4429506deb512b2fe1d0267f38a28cda20af55 /client/src/app/+signup
parent8c360747995e17eb5520e22fc3d7bd4c3d26eeee (diff)
downloadPeerTube-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/+signup')
-rw-r--r--client/src/app/+signup/+register/register.component.ts10
-rw-r--r--client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts12
-rw-r--r--client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts8
3 files changed, 10 insertions, 20 deletions
diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts
index 3e8171b27..153a6d2b5 100644
--- a/client/src/app/+signup/+register/register.component.ts
+++ b/client/src/app/+signup/+register/register.component.ts
@@ -5,7 +5,6 @@ import { AuthService, Notifier, UserService } from '@app/core'
5import { HooksService } from '@app/core/plugins/hooks.service' 5import { HooksService } from '@app/core/plugins/hooks.service'
6import { InstanceService } from '@app/shared/shared-instance' 6import { InstanceService } from '@app/shared/shared-instance'
7import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap' 7import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap'
8import { I18n } from '@ngx-translate/i18n-polyfill'
9import { UserRegister } from '@shared/models' 8import { UserRegister } from '@shared/models'
10import { About, ServerConfig } from '@shared/models/server' 9import { About, ServerConfig } from '@shared/models/server'
11 10
@@ -42,9 +41,8 @@ export class RegisterComponent implements OnInit {
42 private notifier: Notifier, 41 private notifier: Notifier,
43 private userService: UserService, 42 private userService: UserService,
44 private instanceService: InstanceService, 43 private instanceService: InstanceService,
45 private hooks: HooksService, 44 private hooks: HooksService
46 private i18n: I18n 45 ) {
47 ) {
48 } 46 }
49 47
50 get requiresEmailVerification () { 48 get requiresEmailVerification () {
@@ -114,7 +112,7 @@ export class RegisterComponent implements OnInit {
114 this.signupDone = true 112 this.signupDone = true
115 113
116 if (this.requiresEmailVerification) { 114 if (this.requiresEmailVerification) {
117 this.info = this.i18n('Now please check your emails to verify your account and complete signup.') 115 this.info = $localize`Now please check your emails to verify your account and complete signup.`
118 return 116 return
119 } 117 }
120 118
@@ -122,7 +120,7 @@ export class RegisterComponent implements OnInit {
122 this.authService.login(body.username, body.password) 120 this.authService.login(body.username, body.password)
123 .subscribe( 121 .subscribe(
124 () => { 122 () => {
125 this.success = this.i18n('You are now logged in as {{username}}!', { username: body.username }) 123 this.success = $localize`You are now logged in as ${body.username}!`
126 }, 124 },
127 125
128 err => this.error = err.message 126 err => this.error = err.message
diff --git a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
index 51910471b..b26581d2b 100644
--- a/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
+++ b/client/src/app/+signup/+verify-account/verify-account-ask-send-email/verify-account-ask-send-email.component.ts
@@ -1,7 +1,6 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { Notifier, RedirectService, ServerService, UserService } from '@app/core' 2import { Notifier, RedirectService, ServerService, UserService } from '@app/core'
3import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms' 3import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5import { ServerConfig } from '@shared/models' 4import { ServerConfig } from '@shared/models'
6 5
7@Component({ 6@Component({
@@ -19,9 +18,8 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements
19 private userService: UserService, 18 private userService: UserService,
20 private serverService: ServerService, 19 private serverService: ServerService,
21 private notifier: Notifier, 20 private notifier: Notifier,
22 private redirectService: RedirectService, 21 private redirectService: RedirectService
23 private i18n: I18n 22 ) {
24 ) {
25 super() 23 super()
26 } 24 }
27 25
@@ -44,11 +42,7 @@ export class VerifyAccountAskSendEmailComponent extends FormReactive implements
44 this.userService.askSendVerifyEmail(email) 42 this.userService.askSendVerifyEmail(email)
45 .subscribe( 43 .subscribe(
46 () => { 44 () => {
47 const message = this.i18n( 45 this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
48 'An email with verification link will be sent to {{email}}.',
49 { email }
50 )
51 this.notifier.success(message)
52 this.redirectService.redirectToHomepage() 46 this.redirectService.redirectToHomepage()
53 }, 47 },
54 48
diff --git a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts
index 586f4e231..acc688ab3 100644
--- a/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts
+++ b/client/src/app/+signup/+verify-account/verify-account-email/verify-account-email.component.ts
@@ -1,7 +1,6 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { ActivatedRoute } from '@angular/router' 2import { ActivatedRoute } from '@angular/router'
3import { AuthService, Notifier, UserService } from '@app/core' 3import { AuthService, Notifier, UserService } from '@app/core'
4import { I18n } from '@ngx-translate/i18n-polyfill'
5 4
6@Component({ 5@Component({
7 selector: 'my-verify-account-email', 6 selector: 'my-verify-account-email',
@@ -20,9 +19,8 @@ export class VerifyAccountEmailComponent implements OnInit {
20 private userService: UserService, 19 private userService: UserService,
21 private authService: AuthService, 20 private authService: AuthService,
22 private notifier: Notifier, 21 private notifier: Notifier,
23 private route: ActivatedRoute, 22 private route: ActivatedRoute
24 private i18n: I18n 23 ) {
25 ) {
26 } 24 }
27 25
28 ngOnInit () { 26 ngOnInit () {
@@ -32,7 +30,7 @@ export class VerifyAccountEmailComponent implements OnInit {
32 this.isPendingEmail = queryParams['isPendingEmail'] === 'true' 30 this.isPendingEmail = queryParams['isPendingEmail'] === 'true'
33 31
34 if (!this.userId || !this.verificationString) { 32 if (!this.userId || !this.verificationString) {
35 this.notifier.error(this.i18n('Unable to find user id or verification string.')) 33 this.notifier.error($localize`Unable to find user id or verification string.`)
36 } else { 34 } else {
37 this.verifyEmail() 35 this.verifyEmail()
38 } 36 }