aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/instance/instance.service.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/instance/instance.service.ts')
-rw-r--r--client/src/app/shared/instance/instance.service.ts45
1 files changed, 28 insertions, 17 deletions
diff --git a/client/src/app/shared/instance/instance.service.ts b/client/src/app/shared/instance/instance.service.ts
index 44b413fa4..8b26063fb 100644
--- a/client/src/app/shared/instance/instance.service.ts
+++ b/client/src/app/shared/instance/instance.service.ts
@@ -1,4 +1,4 @@
1import { catchError } from 'rxjs/operators' 1import { catchError, map } from 'rxjs/operators'
2import { HttpClient } from '@angular/common/http' 2import { HttpClient } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { environment } from '../../../environments/environment' 4import { environment } from '../../../environments/environment'
@@ -7,6 +7,7 @@ import { About } from '../../../../../shared/models/server'
7import { MarkdownService } from '@app/shared/renderer' 7import { MarkdownService } from '@app/shared/renderer'
8import { peertubeTranslate } from '@shared/models' 8import { peertubeTranslate } from '@shared/models'
9import { ServerService } from '@app/core' 9import { ServerService } from '@app/core'
10import { forkJoin } from 'rxjs'
10 11
11@Injectable() 12@Injectable()
12export class InstanceService { 13export class InstanceService {
@@ -57,25 +58,35 @@ export class InstanceService {
57 return html 58 return html
58 } 59 }
59 60
60 buildTranslatedLanguages (about: About, translations: any) { 61 buildTranslatedLanguages (about: About) {
61 const languagesArray = this.serverService.getVideoLanguages() 62 return forkJoin([
63 this.serverService.getVideoLanguages(),
64 this.serverService.getServerLocale()
65 ]).pipe(
66 map(([ languagesArray, translations ]) => {
67 return about.instance.languages
68 .map(l => {
69 const languageObj = languagesArray.find(la => la.id === l)
62 70
63 return about.instance.languages 71 return peertubeTranslate(languageObj.label, translations)
64 .map(l => { 72 })
65 const languageObj = languagesArray.find(la => la.id === l) 73 })
66 74 )
67 return peertubeTranslate(languageObj.label, translations)
68 })
69 } 75 }
70 76
71 buildTranslatedCategories (about: About, translations: any) { 77 buildTranslatedCategories (about: About) {
72 const categoriesArray = this.serverService.getVideoCategories() 78 return forkJoin([
73 79 this.serverService.getVideoCategories(),
74 return about.instance.categories 80 this.serverService.getServerLocale()
75 .map(c => { 81 ]).pipe(
76 const categoryObj = categoriesArray.find(ca => ca.id === c) 82 map(([ categoriesArray, translations ]) => {
83 return about.instance.categories
84 .map(c => {
85 const categoryObj = categoriesArray.find(ca => ca.id === c)
77 86
78 return peertubeTranslate(categoryObj.label, translations) 87 return peertubeTranslate(categoryObj.label, translations)
79 }) 88 })
89 })
90 )
80 } 91 }
81} 92}