aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/auth/auth.service.ts17
-rw-r--r--client/src/app/core/confirm/confirm.component.html2
-rw-r--r--client/src/app/core/confirm/confirm.component.ts8
3 files changed, 17 insertions, 10 deletions
diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 614d38d08..363f58155 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -1,5 +1,5 @@
1import { Observable, ReplaySubject, Subject, throwError as observableThrowError } from 'rxjs' 1import { Observable, ReplaySubject, Subject, throwError as observableThrowError } from 'rxjs'
2import { catchError, map, mergeMap, tap, share } from 'rxjs/operators' 2import { catchError, map, mergeMap, share, tap } from 'rxjs/operators'
3import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { Router } from '@angular/router' 5import { Router } from '@angular/router'
@@ -13,6 +13,7 @@ import { AuthStatus } from './auth-status.model'
13import { AuthUser } from './auth-user.model' 13import { AuthUser } from './auth-user.model'
14import { objectToUrlEncoded } from '@app/shared/misc/utils' 14import { objectToUrlEncoded } from '@app/shared/misc/utils'
15import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage' 15import { peertubeLocalStorage } from '@app/shared/misc/peertube-local-storage'
16import { I18n } from '@ngx-translate/i18n-polyfill'
16 17
17interface UserLoginWithUsername extends UserLogin { 18interface UserLoginWithUsername extends UserLogin {
18 access_token: string 19 access_token: string
@@ -46,7 +47,8 @@ export class AuthService {
46 private http: HttpClient, 47 private http: HttpClient,
47 private notificationsService: NotificationsService, 48 private notificationsService: NotificationsService,
48 private restExtractor: RestExtractor, 49 private restExtractor: RestExtractor,
49 private router: Router 50 private router: Router,
51 private i18n: I18n
50 ) { 52 ) {
51 this.loginChanged = new Subject<AuthStatus>() 53 this.loginChanged = new Subject<AuthStatus>()
52 this.loginChangedSource = this.loginChanged.asObservable() 54 this.loginChangedSource = this.loginChanged.asObservable()
@@ -74,14 +76,15 @@ export class AuthService {
74 let errorMessage = error.message 76 let errorMessage = error.message
75 77
76 if (error.status === 403) { 78 if (error.status === 403) {
77 errorMessage = `Cannot retrieve OAuth Client credentials: ${error.text}. \n` 79 errorMessage = this.i18n('Cannot retrieve OAuth Client credentials: {{ errorText }}.\n', { errorText: error.text })
78 errorMessage += 'Ensure you have correctly configured PeerTube (config/ directory), ' + 80 errorMessage += this.i18n(
79 'in particular the "webserver" section.' 81 'Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.'
82 )
80 } 83 }
81 84
82 // We put a bigger timeout 85 // We put a bigger timeout
83 // This is an important message 86 // This is an important message
84 this.notificationsService.error('Error', errorMessage, { timeOut: 7000 }) 87 this.notificationsService.error(this.i18n('Error'), errorMessage, { timeOut: 7000 })
85 } 88 }
86 ) 89 )
87 } 90 }
@@ -180,7 +183,7 @@ export class AuthService {
180 this.router.navigate([ '/login' ]) 183 this.router.navigate([ '/login' ])
181 184
182 return observableThrowError({ 185 return observableThrowError({
183 error: 'You need to reconnect.' 186 error: this.i18n('You need to reconnect.')
184 }) 187 })
185 }), 188 }),
186 share() 189 share()
diff --git a/client/src/app/core/confirm/confirm.component.html b/client/src/app/core/confirm/confirm.component.html
index 01a4e0ac4..3253de4a0 100644
--- a/client/src/app/core/confirm/confirm.component.html
+++ b/client/src/app/core/confirm/confirm.component.html
@@ -16,7 +16,7 @@
16 </div> 16 </div>
17 17
18 <div class="form-group inputs"> 18 <div class="form-group inputs">
19 <span class="action-button action-button-cancel" (click)="cancel()"> 19 <span i18n class="action-button action-button-cancel" (click)="cancel()">
20 Cancel 20 Cancel
21 </span> 21 </span>
22 22
diff --git a/client/src/app/core/confirm/confirm.component.ts b/client/src/app/core/confirm/confirm.component.ts
index 147bc9d65..02b38489a 100644
--- a/client/src/app/core/confirm/confirm.component.ts
+++ b/client/src/app/core/confirm/confirm.component.ts
@@ -3,6 +3,7 @@ import { Component, HostListener, OnInit, ViewChild } from '@angular/core'
3import { ModalDirective } from 'ngx-bootstrap/modal' 3import { ModalDirective } from 'ngx-bootstrap/modal'
4 4
5import { ConfirmService } from './confirm.service' 5import { ConfirmService } from './confirm.service'
6import { I18n } from '@ngx-translate/i18n-polyfill'
6 7
7@Component({ 8@Component({
8 selector: 'my-confirm', 9 selector: 'my-confirm',
@@ -20,7 +21,10 @@ export class ConfirmComponent implements OnInit {
20 inputValue = '' 21 inputValue = ''
21 confirmButtonText = '' 22 confirmButtonText = ''
22 23
23 constructor (private confirmService: ConfirmService) { 24 constructor (
25 private confirmService: ConfirmService,
26 private i18n: I18n
27 ) {
24 // Empty 28 // Empty
25 } 29 }
26 30
@@ -38,7 +42,7 @@ export class ConfirmComponent implements OnInit {
38 this.inputLabel = inputLabel 42 this.inputLabel = inputLabel
39 this.expectedInputValue = expectedInputValue 43 this.expectedInputValue = expectedInputValue
40 44
41 this.confirmButtonText = confirmButtonText || 'Confirm' 45 this.confirmButtonText = confirmButtonText || this.i18n('Confirm')
42 46
43 this.showModal() 47 this.showModal()
44 } 48 }