Merge pull request #17160 from 854562/truncate-language-strings

Truncate ISO-639-2 language display names at first delimiter
This commit is contained in:
Cody Robibero
2026-07-21 11:22:32 -04:00
committed by GitHub
5 changed files with 69 additions and 8 deletions
@@ -119,6 +119,40 @@ namespace Jellyfin.Server.Implementations.Tests.Localization
Assert.Equal(code, culture.ThreeLetterISOLanguageName);
}
[Theory]
[InlineData("ell", "Greek")] // Comma truncation
[InlineData("nld", "Dutch")] // Semicolon truncation
[InlineData("ron", "Romanian")] // Semicolon truncation, multiple
[InlineData("eng", "English")] // No truncation
[InlineData("zh-CN", "Chinese (Simplified)")] // No truncation, with parentheses
public async Task GetLanguageDisplayName_DelimitedName_ReturnsTruncatedName(string language, string expected)
{
var localizationManager = Setup(new ServerConfiguration
{
UICulture = "en-US"
});
await localizationManager.LoadAll();
var result = localizationManager.GetLanguageDisplayName(language);
Assert.Equal(expected, result);
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData("xyz")]
public async Task GetLanguageDisplayName_InvalidInput_ReturnsNull(string? language)
{
var localizationManager = Setup(new ServerConfiguration
{
UICulture = "en-US"
});
await localizationManager.LoadAll();
var result = localizationManager.GetLanguageDisplayName(language!);
Assert.Null(result);
}
[Fact]
public async Task GetParentalRatings_Default_Success()
{