diff options
Diffstat (limited to 'client/src/app/shared')
-rw-r--r-- | client/src/app/shared/shared-forms/select/select-languages.component.ts | 16 |
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) |