From 5c6a94a7317780e8b206791a2364199c5c087263 Mon Sep 17 00:00:00 2001 From: CWX Date: Fri, 2 May 2025 20:24:48 +0100 Subject: [PATCH] fix custom locales not overwriting existing ones --- .../Services/LocaleService.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs index 0f32472d..6b53671b 100644 --- a/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs +++ b/Libraries/SPTarkov.Server.Core/Services/LocaleService.cs @@ -73,7 +73,21 @@ public class LocaleService( /// A dictionary representing the merged result of database and custom locales. private Dictionary CombineDbWithCustomLocales(Dictionary dbLocales, Dictionary customLocales) { - return dbLocales.Union(customLocales).ToDictionary(x => x.Key, x => x.Value); + try + { + return dbLocales + .Concat(customLocales) + .GroupBy(kvp => kvp.Key) + .ToDictionary( + group => group.Key, + group => group.Last().Value + ); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } } /// @@ -241,7 +255,7 @@ public class LocaleService( if (!localeDictToAddTo.TryAdd(localeKey, localeValue)) { - _logger.Error($"Unable to add: {localeKey} {localeValue} to custom locale dictionary: {locale}"); + localeDictToAddTo[localeKey] = localeValue; } }