From 81c7e8ba95018fae45c15c931ef4f8fa1f0d9316 Mon Sep 17 00:00:00 2001 From: maj00r Date: Sun, 1 Nov 2026 16:16:39 +0100 Subject: [PATCH] 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. --- StarterNG/Services/LocalizationService.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/StarterNG/Services/LocalizationService.cs b/StarterNG/Services/LocalizationService.cs index 2f83ce9..a7dda79 100644 --- a/StarterNG/Services/LocalizationService.cs +++ b/StarterNG/Services/LocalizationService.cs @@ -275,13 +275,15 @@ public class LocalizationService : INotifyPropertyChanged, ILocalizedStrings /// 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); } }