Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IsMatch logic #188

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Jellyfin.Plugin.Tvdb/TvdbSdkExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,17 @@ private static bool IsMatch(this string translation, string? language)
return false;
}

language = language?.ToLowerInvariant() switch
var mappedlanguage = language?.ToLowerInvariant() switch
{
"zh-tw" => "zhtw", // Unique case for zh-TW
"pt-br" => "pt", // Unique case for pt-BR0
"pt-pt" => "por", // Unique case for pt-PT
_ => language,
_ => null,
};

if (translation.Equals(language, StringComparison.OrdinalIgnoreCase))
if (mappedlanguage is not null)
{
return true;
return translation.Equals(mappedlanguage, StringComparison.OrdinalIgnoreCase);
}

// try to find a match (ISO 639-2)
Expand Down