Merge pull request #7388 from GermanCoding/iso639-undefined

This commit is contained in:
Cody Robibero 2022-03-05 12:43:51 -07:00 committed by GitHub
commit 3dc0cfc36e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 1 deletions

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Jellyfin.Extensions;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
@ -17,6 +18,18 @@ namespace MediaBrowser.Model.Entities
/// </summary>
public class MediaStream
{
private static readonly string[] _specialCodes =
{
// Uncoded languages.
"mis",
// Multiple languages.
"mul",
// Undetermined.
"und",
// No linguistic content; not applicable.
"zxx"
};
/// <summary>
/// Gets or sets the codec.
/// </summary>
@ -137,7 +150,8 @@ namespace MediaBrowser.Model.Entities
{
var attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
// Do not display the language code in display titles if unset or set to a special code. Show it in all other cases (possibly expanded).
if (!string.IsNullOrEmpty(Language) && !_specialCodes.Contains(Language, StringComparison.OrdinalIgnoreCase))
{
// Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
string fullLanguage = CultureInfo