From 1c9ba2ab1f4cc837a3a1bd907fe7904bb77d853c Mon Sep 17 00:00:00 2001 From: Ben Olden-Cooligan Date: Sat, 16 Dec 2023 21:46:21 -0800 Subject: [PATCH] Fix language dropdown on Mac/Linux --- NAPS2.App.Tests/Appium/LanguageSelectionTests.cs | 2 +- NAPS2.Lib/Util/CultureHelper.cs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NAPS2.App.Tests/Appium/LanguageSelectionTests.cs b/NAPS2.App.Tests/Appium/LanguageSelectionTests.cs index 88b0f67b0..d2a557450 100644 --- a/NAPS2.App.Tests/Appium/LanguageSelectionTests.cs +++ b/NAPS2.App.Tests/Appium/LanguageSelectionTests.cs @@ -11,7 +11,7 @@ namespace NAPS2.App.Tests.Appium; [Collection("appium")] public class LanguageSelectionTests : AppiumTests { - private static readonly HashSet ExpectedMissingLanguages = ["bn", "hi", "id", "th", "ur"]; + private static readonly HashSet ExpectedMissingLanguages = ["bn", "ur"]; [VerifyTheory(AllowDebug = true, WindowsAppium = true)] [ClassData(typeof(AppiumTestData))] diff --git a/NAPS2.Lib/Util/CultureHelper.cs b/NAPS2.Lib/Util/CultureHelper.cs index 2c38913a8..e038f2461 100644 --- a/NAPS2.Lib/Util/CultureHelper.cs +++ b/NAPS2.Lib/Util/CultureHelper.cs @@ -54,6 +54,12 @@ public class CultureHelper public IEnumerable<(string langCode, string langName)> GetAvailableCultures() { +#if NET6_0_OR_GREATER + // For self-contained builds we don't have separate DLL files we can check for existence + // TODO: Don't want to hard code this... it defeats the whole purpose of autodetection + var exclude = new HashSet { "bn", "ur" }; + return GetAllCultures().Where(x => !exclude.Contains(x.langCode)); +#else foreach (var (langCode, langName) in GetAllCultures()) { // Only include those languages for which localized resources exist @@ -65,5 +71,6 @@ public class CultureHelper yield return (langCode, langName); } } +#endif } } \ No newline at end of file