Truncate ISO-639-2 language display names at first delimiter

Prevents raw ISO-639-2 values (e.g. "Greek, Modern (1453-)" from cluttering the audio and subtitle display names by truncating them at the first comma or semicolon ("Greek"). Applies to MediaStreamRepository and ProbeResultNormalizer.
This commit is contained in:
854562
2026-06-22 20:25:13 +02:00
committed by GitHub
parent da2b994fff
commit 94d5326411
2 changed files with 10 additions and 3 deletions
@@ -173,7 +173,10 @@ public class MediaStreamRepository : IMediaStreamRepository
if (!string.IsNullOrEmpty(dto.Language))
{
var culture = _localization.FindLanguageInfo(dto.Language);
dto.LocalizedLanguage = culture?.DisplayName;
// Truncate at the first delimiter to avoid cluttered display names
dto.LocalizedLanguage = culture?.DisplayName is { } name
? name.Split(';', ',')[0].Trim()
: null;
}
if (dto.Type is MediaStreamType.Audio)
@@ -732,7 +732,9 @@ namespace MediaBrowser.MediaEncoding.Probing
stream.LocalizedOriginal = _localization.GetLocalizedString("Original");
stream.LocalizedLanguage = string.IsNullOrEmpty(stream.Language)
? null
: _localization.FindLanguageInfo(stream.Language)?.DisplayName;
: _localization.FindLanguageInfo(stream.Language)?.DisplayName is { } name
? name.Split(';', ',')[0].Trim()
: null;
stream.Channels = streamInfo.Channels;
@@ -773,7 +775,9 @@ namespace MediaBrowser.MediaEncoding.Probing
stream.LocalizedHearingImpaired = _localization.GetLocalizedString("HearingImpaired");
stream.LocalizedLanguage = string.IsNullOrEmpty(stream.Language)
? null
: _localization.FindLanguageInfo(stream.Language)?.DisplayName;
: _localization.FindLanguageInfo(stream.Language)?.DisplayName is { } name
? name.Split(';', ',')[0].Trim()
: null;
if (string.IsNullOrEmpty(stream.Title))
{