Front: MediaInfo: Show 'Default' only if there is more than 1 track + add missing translations

This commit is contained in:
Arthur Jamet 2024-01-22 09:08:06 +01:00 committed by Zoe Roux
parent 4332bfee9b
commit b98df08f44
3 changed files with 11 additions and 5 deletions

View File

@ -39,14 +39,16 @@ const MediaInfoTable = ({
if (trackTable.length == 0) {
return undefined;
}
const singleTrack = trackTable.length == 1
return trackTable.reduce(
(collected, audioTrack, index) => ({
...collected,
// If there is only one track, we do not need to show an index
[trackTable.length == 1 ? t(s) : `${t(s)} ${index + 1}`]: [
[singleTrack ? t(s) : `${t(s)} ${index + 1}`]: [
audioTrack.displayName,
audioTrack.isDefault ? t("Default") : undefined,
audioTrack.isForced ? t("Forced") : undefined,
// Only show it if there is more than one track
(audioTrack.isDefault && !singleTrack) ? t("mediainfo.default") : undefined,
audioTrack.isForced ? t("mediainfo.forced") : undefined,
audioTrack.codec,
]
.filter((x) => x !== undefined)

View File

@ -181,6 +181,8 @@
"container": "Container",
"video": "Video",
"audio": "Audio",
"subtitles": "Subtitles"
"subtitles": "Subtitles",
"forced": "Forced",
"default": "Default"
}
}

View File

@ -181,6 +181,8 @@
"container": "Conteneur",
"video": "Video",
"audio": "Audio",
"subtitles": "Sous titres"
"subtitles": "Sous titres",
"forced": "Forcé",
"default": "Par Défaut"
}
}