Fix zh-CN subtitle language display (#15947)

The DisplayTitle property was using .NET's CultureInfo.GetCultures(NeutralCultures)
to resolve language display names. Since zh-CN is a specific culture (not neutral),
it would fall back to the base 'zh' code, resulting in generic 'Chinese' instead
of 'Chinese (Simplified)'.

This change adds a LocalizedLanguage property to MediaStream that gets populated
via LocalizationManager.FindLanguageInfo() when streams are retrieved from the
database. This leverages Jellyfin's existing iso6392.txt mappings which correctly
map zh-CN to 'Chinese (Simplified)'.

The same pattern is already used for other localized strings like LocalizedDefault
and LocalizedExternal.
This commit is contained in:
Bond-009
2026-01-18 12:19:31 +01:00
committed by GitHub
3 changed files with 55 additions and 46 deletions

View File

@@ -108,6 +108,49 @@ namespace Jellyfin.Model.Tests.Entities
IsExternal = true
});
// Test LocalizedLanguage is used when set (fixes zh-CN display issue #15935)
data.Add(
"Chinese (Simplified) - SRT",
new MediaStream
{
Type = MediaStreamType.Subtitle,
Title = null,
Language = "zh-CN",
LocalizedLanguage = "Chinese (Simplified)",
IsForced = false,
IsDefault = false,
Codec = "SRT"
});
// Test LocalizedLanguage for audio streams
data.Add(
"Japanese - AAC - Stereo",
new MediaStream
{
Type = MediaStreamType.Audio,
Title = null,
Language = "jpn",
LocalizedLanguage = "Japanese",
IsForced = false,
IsDefault = false,
Codec = "AAC",
ChannelLayout = "stereo"
});
// Test fallback to Language when LocalizedLanguage is null
data.Add(
"Eng - ASS",
new MediaStream
{
Type = MediaStreamType.Subtitle,
Title = null,
Language = "eng",
LocalizedLanguage = null,
IsForced = false,
IsDefault = false,
Codec = "ASS"
});
return data;
}