aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorFlorian CUNY <poslovitch@bentobox.world>2021-12-24 09:27:27 +0100
committerGitHub <noreply@github.com>2021-12-24 09:27:27 +0100
commit1e9c1b1b44b4cbd4bc4b1e97e8e6ba2df93371de (patch)
treeb597d355b79ab9ef83377d8dc4d94d75dd11ebef /client/src/app/shared
parent5354af75b372cf079384d44592a58f1db96982f6 (diff)
downloadPeerTube-1e9c1b1b44b4cbd4bc4b1e97e8e6ba2df93371de.tar.gz
PeerTube-1e9c1b1b44b4cbd4bc4b1e97e8e6ba2df93371de.tar.zst
PeerTube-1e9c1b1b44b4cbd4bc4b1e97e8e6ba2df93371de.zip
Move zxx to its own group in select-languages component (#4664)
* Move zxx to its own group in select-languages component * Fix lint * Fix lint, again * Apply requested changes
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/shared-forms/select/select-languages.component.ts16
1 files changed, 13 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-forms/select/select-languages.component.ts b/client/src/app/shared/shared-forms/select/select-languages.component.ts
index 742163ede..6b5415785 100644
--- a/client/src/app/shared/shared-forms/select/select-languages.component.ts
+++ b/client/src/app/shared/shared-forms/select/select-languages.component.ts
@@ -20,7 +20,7 @@ export class SelectLanguagesComponent implements ControlValueAccessor, OnInit {
20 @Input() maxLanguages: number 20 @Input() maxLanguages: number
21 21
22 selectedLanguages: ItemSelectCheckboxValue[] 22 selectedLanguages: ItemSelectCheckboxValue[]
23 availableLanguages: SelectOptionsItem[] = [] 23 availableLanguages: (SelectOptionsItem & { groupOrder: number })[] = []
24 24
25 allLanguagesGroup = $localize`All languages` 25 allLanguagesGroup = $localize`All languages`
26 26
@@ -38,10 +38,20 @@ export class SelectLanguagesComponent implements ControlValueAccessor, OnInit {
38 this.server.getVideoLanguages() 38 this.server.getVideoLanguages()
39 .subscribe( 39 .subscribe(
40 languages => { 40 languages => {
41 this.availableLanguages = [ { label: $localize`Unknown language`, id: '_unknown', group: this.allLanguagesGroup } ] 41 this.availableLanguages = [ {
42 label: $localize`Unknown language`,
43 id: '_unknown',
44 group: this.allLanguagesGroup,
45 groupOrder: 1
46 } ]
42 47
43 this.availableLanguages = this.availableLanguages 48 this.availableLanguages = this.availableLanguages
44 .concat(languages.map(l => ({ label: l.label, id: l.id, group: this.allLanguagesGroup }))) 49 .concat(languages.map(l => {
50 if (l.id === 'zxx') return { label: l.label, id: l.id, group: $localize`Other`, groupOrder: 0 }
51 return { label: l.label, id: l.id, group: this.allLanguagesGroup, groupOrder: 1 }
52 }))
53
54 this.availableLanguages.sort((a, b) => a.groupOrder - b.groupOrder)
45 55
46 this.loaded = true 56 this.loaded = true
47 this.writeValue(this.toWrite) 57 this.writeValue(this.toWrite)