From 2cd2f36fe4912cb465cf5e78a055463f8a5c44a9 Mon Sep 17 00:00:00 2001
From: 854562 <44002186+854562@users.noreply.github.com>
Date: Mon, 20 Jul 2026 22:00:10 +0200
Subject: Extract truncation logic to helper and add tests
---
.../Localization/LocalizationManager.cs | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
(limited to 'Emby.Server.Implementations/Localization/LocalizationManager.cs')
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs
index 843e35afcc..068dde639e 100644
--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs
+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs
@@ -261,6 +261,24 @@ namespace Emby.Server.Implementations.Localization
_cultures);
}
+ ///
+ 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();
+ }
+
///
public IReadOnlyList GetCountries()
{
--
cgit v1.2.3