diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-04 16:21:17 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-05 08:43:01 +0200 |
commit | b1d40cff89f7cff565a98cdbcea9a624196a169a (patch) | |
tree | d24746c1cc69f50471a9eba0dfb1c1bae06a1870 /client/src/app/shared/rest | |
parent | 989e526abf0c0dd7958deb630df009608561bb67 (diff) | |
download | PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.gz PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.tar.zst PeerTube-b1d40cff89f7cff565a98cdbcea9a624196a169a.zip |
Add i18n attributes
Diffstat (limited to 'client/src/app/shared/rest')
-rw-r--r-- | client/src/app/shared/rest/rest-extractor.service.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/client/src/app/shared/rest/rest-extractor.service.ts b/client/src/app/shared/rest/rest-extractor.service.ts index 39e601e20..468ac3e32 100644 --- a/client/src/app/shared/rest/rest-extractor.service.ts +++ b/client/src/app/shared/rest/rest-extractor.service.ts | |||
@@ -3,11 +3,15 @@ import { Injectable } from '@angular/core' | |||
3 | import { dateToHuman } from '@app/shared/misc/utils' | 3 | import { dateToHuman } from '@app/shared/misc/utils' |
4 | import { ResultList } from '../../../../../shared' | 4 | import { ResultList } from '../../../../../shared' |
5 | import { Router } from '@angular/router' | 5 | import { Router } from '@angular/router' |
6 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | 7 | ||
7 | @Injectable() | 8 | @Injectable() |
8 | export class RestExtractor { | 9 | export class RestExtractor { |
9 | 10 | ||
10 | constructor (private router: Router) { | 11 | constructor ( |
12 | private router: Router, | ||
13 | private i18n: I18n | ||
14 | ) { | ||
11 | // empty | 15 | // empty |
12 | } | 16 | } |
13 | 17 | ||
@@ -60,17 +64,19 @@ export class RestExtractor { | |||
60 | } else if (err.error && err.error.error) { | 64 | } else if (err.error && err.error.error) { |
61 | errorMessage = err.error.error | 65 | errorMessage = err.error.error |
62 | } else if (err.status === 413) { | 66 | } else if (err.status === 413) { |
63 | errorMessage = 'Request is too large for the server. Please contact you administrator if you want to increase the limit size.' | 67 | errorMessage = this.i18n( |
68 | 'Request is too large for the server. Please contact you administrator if you want to increase the limit size.' | ||
69 | ) | ||
64 | } else if (err.status === 429) { | 70 | } else if (err.status === 429) { |
65 | const secondsLeft = err.headers.get('retry-after') | 71 | const secondsLeft = err.headers.get('retry-after') |
66 | if (secondsLeft) { | 72 | if (secondsLeft) { |
67 | const minutesLeft = Math.floor(parseInt(secondsLeft, 10) / 60) | 73 | const minutesLeft = Math.floor(parseInt(secondsLeft, 10) / 60) |
68 | errorMessage = 'Too many attempts, please try again after ' + minutesLeft + ' minutes.' | 74 | errorMessage = this.i18n('Too many attempts, please try again after {{ minutesLeft }} minutes.', { minutesLeft }) |
69 | } else { | 75 | } else { |
70 | errorMessage = 'Too many attempts, please try again later.' | 76 | errorMessage = this.i18n('Too many attempts, please try again later.') |
71 | } | 77 | } |
72 | } else if (err.status === 500) { | 78 | } else if (err.status === 500) { |
73 | errorMessage = 'Server error. Please retry later.' | 79 | errorMessage = this.i18n('Server error. Please retry later.') |
74 | } | 80 | } |
75 | 81 | ||
76 | errorMessage = errorMessage ? errorMessage : 'Unknown error.' | 82 | errorMessage = errorMessage ? errorMessage : 'Unknown error.' |