Extract truncation logic to helper and add tests
This commit is contained in:
@@ -261,6 +261,24 @@ namespace Emby.Server.Implementations.Localization
|
||||
_cultures);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string? GetLanguageDisplayName(string language)
|
||||
{
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var displayName = FindLanguageInfo(language)?.DisplayName;
|
||||
if (displayName is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Truncate at the first delimiter to avoid cluttered display names
|
||||
return displayName.Split([';', ','], StringSplitOptions.None)[0].Trim();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<CountryInfo> GetCountries()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user