diff options
| author | Cody Robibero <cody@robibe.ro> | 2026-07-21 11:22:32 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-07-21 11:22:32 -0400 |
| commit | 65836cc844e6ef3d4b25b875668c4d32105a4dae (patch) | |
| tree | 96db72199e6b26c8c96b2e68f06ba4a466aaab45 /Emby.Server.Implementations | |
| parent | b4090bdcb24bb99087a492bdbc370878738d5086 (diff) | |
| parent | 2cd2f36fe4912cb465cf5e78a055463f8a5c44a9 (diff) | |
Merge pull request #17160 from 854562/truncate-language-strings
Truncate ISO-639-2 language display names at first delimiter
Diffstat (limited to 'Emby.Server.Implementations')
| -rw-r--r-- | Emby.Server.Implementations/Localization/LocalizationManager.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index e7dd984ec4..0331ec39e5 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -262,6 +262,24 @@ namespace Emby.Server.Implementations.Localization } /// <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() { using var stream = _assembly.GetManifestResourceStream(CountriesPath) ?? throw new InvalidOperationException($"Invalid resource path: '{CountriesPath}'"); |
