Find an old starter's language file on Linux too

The list of languages holds codes in lower case, so lang-ZH.txt was not found
on a case-sensitive file system and its key descriptions stayed empty.
This commit is contained in:
maj00r
2026-11-01 16:16:39 +01:00
parent b56a2a0ae6
commit 81c7e8ba95

View File

@@ -275,13 +275,15 @@ public class LocalizationService : INotifyPropertyChanged, ILocalizedStrings
/// </summary>
private void ReadOldKeyDescriptions(string code)
{
if (string.IsNullOrEmpty(_folders.OldStarter))
if (string.IsNullOrEmpty(_folders.OldStarter) || !Directory.Exists(_folders.OldStarter))
return;
string path = Path.Combine(_folders.OldStarter, $"lang-{code}.txt");
try
{
if (!File.Exists(path))
// The list holds codes in lower case and the file may be lang-ZH.txt; on Linux those differ.
string? path = Directory.EnumerateFiles(_folders.OldStarter, "lang-*.txt")
.FirstOrDefault(file => string.Equals(Path.GetFileNameWithoutExtension(file), $"lang-{code}", StringComparison.OrdinalIgnoreCase));
if (path is null)
return;
bool inDescriptions = false;
@@ -304,7 +306,7 @@ public class LocalizationService : INotifyPropertyChanged, ILocalizedStrings
}
catch (Exception ex)
{
_log.Log($"reading {path}", ex);
_log.Log($"reading lang-{code}.txt", ex);
}
}