Improve OriginalLanguage normalization and inheritance (#16829)
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
Format / format-check (push) Has been cancelled
Tests / run-tests (macos-latest) (push) Has been cancelled
Tests / run-tests (ubuntu-latest) (push) Has been cancelled
Tests / run-tests (windows-latest) (push) Has been cancelled
OpenAPI Publish / OpenAPI - Publish Artifact (push) Has been cancelled
OpenAPI Publish / OpenAPI - Publish Unstable Spec (push) Has been cancelled
OpenAPI Publish / OpenAPI - Publish Stable Spec (push) Has been cancelled
Project Automation / Project board (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
Stale PR Check / Check PRs with merge conflicts (push) Has been cancelled

Improve OriginalLanguage normalization and inheritance
This commit is contained in:
Erik W
2026-05-26 21:02:43 +02:00
committed by GitHub
parent b015d2d219
commit 4af66c4e1a
6 changed files with 42 additions and 18 deletions

View File

@@ -94,6 +94,8 @@ namespace MediaBrowser.Controller.Entities
private string _name;
private string _originalLanguage;
public const char SlugChar = '-';
protected BaseItem()
@@ -217,7 +219,11 @@ namespace MediaBrowser.Controller.Entities
public string OriginalTitle { get; set; }
[JsonIgnore]
public string OriginalLanguage { get; set; }
public string OriginalLanguage
{
get => _originalLanguage;
set => _originalLanguage = LocalizationManager?.FindLanguageInfo(value)?.TwoLetterISOLanguageName ?? value;
}
/// <summary>
/// Gets or sets the id.
@@ -1564,7 +1570,7 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
/// Gets the preferred metadata language.
/// Gets the preferred metadata country code.
/// </summary>
/// <returns>System.String.</returns>
public string GetPreferredMetadataCountryCode()
@@ -1598,6 +1604,15 @@ namespace MediaBrowser.Controller.Entities
return lang;
}
/// <summary>
/// Gets the original language of the item, inheriting from parent items if necessary.
/// </summary>
/// <returns>System.String.</returns>
public virtual string GetInheritedOriginalLanguage()
{
return OriginalLanguage;
}
public virtual bool IsSaveLocalMetadataEnabled()
{
if (SourceType == SourceType.Channel)