Skip to content

Commit

Permalink
Hide languages from list if unsupported by OS
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0thyj committed Feb 15, 2024
1 parent c55adda commit 5445097
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/LanguageDialog.cs
Expand Up @@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Windows.Forms;

namespace WinDynamicDesktop
Expand All @@ -26,9 +27,16 @@ private void LanguageDialog_Load(object sender, EventArgs e)
{
foreach (string langCode in Localization.languageCodes)
{
languageNames.Add(new CultureInfo(langCode).NativeName);
try
{
languageNames.Add(new CultureInfo(langCode).NativeName);
}
catch (CultureNotFoundException)
{
languageNames.Add(null);
}
}
comboBox1.Items.AddRange(languageNames.ToArray());
comboBox1.Items.AddRange(languageNames.Where(x => x != null).ToArray());
comboBox1.Sorted = true;

int langIndex = Array.IndexOf(Localization.languageCodes, Localization.currentLocale);
Expand Down

0 comments on commit 5445097

Please sign in to comment.