allow selecting multiple foreign languages, closes #97

This commit is contained in:
TheBeastLT
2023-05-08 13:35:26 +02:00
parent 45bce6ea2f
commit c0a45acf63
4 changed files with 21 additions and 16 deletions

View File

@@ -40,10 +40,10 @@ const LanguageOptions = {
}
function sortStreams(streams, config, type) {
const language = config[LanguageOptions.key];
if (language && language !== languages[0]) {
const configLanguages = config[LanguageOptions.key];
if (configLanguages && configLanguages.length && configLanguages[0] !== languages[0]) {
// No need to filter english since it's hard to predict which entries are english
const streamsWithLanguage = streams.filter(stream => containsLanguage(stream, language));
const streamsWithLanguage = streams.filter(stream => containsLanguage(stream, configLanguages));
const streamsNoLanguage = streams.filter(stream => !streamsWithLanguage.includes(stream));
return _sortStreams(streamsWithLanguage, config, type).concat(_sortStreams(streamsNoLanguage, config, type));
}